Jump to content
  • Advertisement
Sign in to follow this  
UserX03

Distance traveled over time with a decreasing velocity

This topic is 3070 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 think this is a calculus problem and my calculus is pretty rusty so I'll appreciate if someone can point out how to solve this. I want to calculate the distance traveled over a given amount of time given a velocity is that is decreasing over that time period. For example, say I have a 2D game with a moving platform. The platform is moving at a velocity of 100 units/second and when it hits a certain point, let's call it point A, the velocity is decreased linearly over 2 seconds until the platform is at a standstill and is now at point B. That is, when the platform reaches point A it is moving at 100 units/second, 1 second after hitting point A is moving at 50 units/second, 1.5 seconds after hitting point A is moving at 25 units/second, 2 seconds after hitting point A is moving at 0 units/second and is now at point B. How do I calculate the distance from point A to point B?

Share this post


Link to post
Share on other sites
Advertisement
With an initial velocity v and a constant acceleration a, distance traveled is equal to v * t + .5 * a * t * t.

Share this post


Link to post
Share on other sites
You can use distance = speed*time, or x = v*t, since the acceleration is linear.

Because the acceleration (well, deceleration) is linear (no way for you to know this necessarily if you're not into calculus), you can use average velocity.

So:

V@A = 100. V@B = 0. V_avg = 50. x = v*t = 50*2 = 100 units.

SiCrane's equation is more rigorous.

"a" (acceleration) = -100/2 (change of -100 units/second in 2 seconds) = -50.

So:
With V@A = 100, his equation becomes 100*2 + 0.5 * -50 * 2 * 2 = 200 + 0.5 * (-200) = 100 units.

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!