Jump to content
  • Advertisement
Sign in to follow this  
Gamer Gamester

Smooth arrivals at targets with preset deceleration rates

This topic is 2995 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

I have an objects travelling at various velocities. Each of these objects also has an associated deceleration value (so when decelerating, their velocities go down by this deceleration value each physics step).

I want to implement smooth arrivals at targets, but I'm having trouble knowing when the objects should begin their deceleration. I want the objects to decelerate at different rates (that's why they each have their own deceleration value), and so they need to begin decelerating at different times, but I'm having trouble figuring out how to go about calculating these times.

Any reasonably efficient suggestions towards this end? Thanks!

Share this post


Link to post
Share on other sites
Advertisement
For an object traveling with initial velocity v and constant acceleration a, velocity is defined by this equation:

v = v0 + a * t

where v0 is the initial velocity. Now you know that at the end velocity should be 0.

0 = v0 + a * t

So just solve for t.

Share this post


Link to post
Share on other sites
Or if you want to know the distance, rather than time, away to start decelerating:

d = a/2*t^2 + v*t, and
0 = v + a*t, so
t = -v/a

Plug in and solve.
d = a/2*(v/a)^2 + -v*v/a = 1/2 v^2 / a

Just check the algebra.

Edit: Oops wrong sign.

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!