Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Naaga

Not another framerate post!

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

Yes, another framerate post. The classic "How do I keep things running at the same speed?" But, most answers to this question are for objects moving at constant speed. My problem is for object movement based on acceleration. If I just divide the movement factor by the framerate, it goes off. I tried dividing by the framerate^2, which appears to give me the right movement--the guy appears to jump the same height in any framerate--but he actually jumps faster and falls faster. If anyone can help me get this math right, I''d appreciate it.

Share this post


Link to post
Share on other sites
Advertisement
let physics be your friend:

standard kinematics of motion equations

s(t) = 1/2 * a * t^2 + v0 * t + s0
v(t) = a * t + v0

where
s(t) = position now
v(t) = velocity now
s0 = last position
a = acceleration
v0 = last velocity
t = time

every time you call your update function pass in the amount of time in seconds that has elapsed since the last frame was calculated. that time is t in those equations. don't bother calculating the second equation if your objects don't accelerate

-me

[edited by - Palidine on November 14, 2003 7:27:17 PM]

Share this post


Link to post
Share on other sites
Thanks for the speedy reply!

So, the first equation gives you the object''s new position, and the second equation gives you the velocity to use in the next frame?

Share this post


Link to post
Share on other sites
Sound like you may have already seen this site; but in case you haven''t; here is the link:

http://www.mvps.org/directx/indexes/game_timing.htm


_______________________________________
Understanding is a three edged sword...

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!