Sign in to follow this  

Stopping distance

Recommended Posts

Hello there.


Something that surely will be quite simple for some of you, but just impossible to solve for me.


I have moving vehicles. The advance at a certain speed, accelerate at a certain rate and deccelerate at another rate.


My problem is to find a formula to get the stopping distance of such vehicles from its max speed and decceleration.


The speed "s" is given in world unit per seconds (us).

The decceleration "d" is given in "us" lost each second while deccelerating.


For example, a vehicle moving at 6us and deccelerating by 2us per seconds will take... 3 seconds to fully stop.


What would be the formula to give me the number of world unit needed to fully stop from full speed to 0, in function of "s" and "d"?



Share this post

Link to post
Share on other sites
Newtonian physics equations should do the trick
// change of position over time
newPosition = position + velocity * time + 0.5 * acceleration * time^2
// change in velocity over time
newVelocity = velocity + acceleration * time
You already used the second equation to solve for time to stop by setting newVelocity to 0 and solving for time

time = -velocity / acceleration
Now just plug time into the first equation to solve for change in position
stoppingDistance = (newPosition - position) = velocity * time + 0.5 * acceleration * time^2
As a game dev, you should have these basic newtonian equations memorized and understand how they work.

Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this