I’m making a physics based movement script with rigidbody.addforce but I need to limit the speed.
Issue is, there will be times in the game when the player is launched in a certain direction and when that happens, I don’t want them to be slowed down by the max speed. So as a solution I decided to just not add force when the player is going faster than the max speed. Long story short I need to find the forward, back, right and left velocity relative to the transform. I’m not sure if that makes any sense but thanks in advance anyways
Hi!
If all you need to check is the individual axes of the velocity, you can just do it with rigidbody.velocity.x / rigidbody.velocity.y .
If you want the non directional total speed, you can just use .magnitude on the velocity.
@TheTrueDuck this is where it gets tricky, I don’t want to know the speed in either axis, rather in certain directions relative to the objects rotation. I hope that makes sense.