- Home /
How to get the players forward speed?
I'm making currently making a 3D fast pace platformer game, and I was wanting to add a speed effect to the game. The idea was that when the player reaches a certain speed, the effect would appear.
My problem is that I don't how to make it so when the player's forward speed is greater than a number, the effect appears. I tried using Rigidbody.velocity but that doesn't have the option to get the player's forward velocity.
Thanks in advance
Answer by Map-Builder · May 28, 2020 at 11:53 PM
Rigidbody.velocity.x on X
Rigidbody.velocity.magnitude on XYZ (but it is using a squareroot, so it is not a fast math compared to multiplication) maybe fine but use
Rigidbody.velocity.sqrMagnitude which is speedxspeed so you can perform : if (Rigidbody.velocity.sqrMagnitude > maxspeed*maxspeed) ...
Your answer
Follow this Question
Related Questions
Throwing a Spear 1 Answer
How do I make a rigidbody 3D wall jump? 1 Answer
Calculate Angular Velocity to Match Remote Position 0 Answers
How to move player on a moving vehicle 0 Answers
Reset Joints to initial state 0 Answers