# Stopping distance

This topic is 1168 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

## 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"?

Spidyy

##### Share on other sites
Distance is the integral of speed. Have you done integrals yet?

##### 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 on other sites

I get this:

stopping_distance = starting_velocity^2 / (2 * deceleration)

And that's it. :) Thanks a lot!

1. 1
2. 2
Rutin
20
3. 3
A4L
15
4. 4
5. 5
khawk
14

• 13
• 26
• 10
• 11
• 9
• ### Forum Statistics

• Total Topics
633738
• Total Posts
3013617
×