Jump to content
  • Advertisement
Sign in to follow this  
Spidyy

Stopping distance

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

If you intended to correct an error in the post then please contact us.

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 this post


Link to post
Share on other sites
Advertisement
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

I get this:

stopping_distance = starting_velocity^2 / (2 * deceleration)

 

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

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!