Archived

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

Not another framerate post!

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

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

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

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 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...

1. 1
Rutin
22
2. 2
3. 3
4. 4
5. 5

• 9
• 9
• 9
• 14
• 12
• Forum Statistics

• Total Topics
633308
• Total Posts
3011294
• Who's Online (See full list)

There are no registered users currently online

×