![](wink.gif)
time-based modelling
Hey all. I''m trying to figure out how to use time-based physics modelling as opposed to frame-based. Here''s my game loop:
while(TRUE)
{
static int lastTime;
int time = GetTickCount() - lastTime;
lastTime = GetTickCount();
//do everything...
}
Now, when would I use time in the equations? Only for movement? Or would I have to use time in calculating acceleration, velocity, gravity and so forth?
A little help would be greatly appreciated
...go on and live with no regrets, you only have one life...
![](wink.gif)
...go on and live with no regrets, you only have one life...
Depends on how anal you are. ![](smile.gif)
You should apply it to anything that is "added to". Theoretically, you ought to have some sort of curved response to things like acceleration (and acceleration of acceleration, etc) but practically, I don''t think it''s worth the trouble.
Keep all your forces in terms of units per second and then everything will make sense in your head when you need to apply them.
![](smile.gif)
You should apply it to anything that is "added to". Theoretically, you ought to have some sort of curved response to things like acceleration (and acceleration of acceleration, etc) but practically, I don''t think it''s worth the trouble.
Keep all your forces in terms of units per second and then everything will make sense in your head when you need to apply them.
Here's how I'm currently doing it for the 2D overhead asteroids type game I'm working. I'm not sure this is the best way, but it seems to work for me. The problem I ran into was when I tried to directly translate physics equations into useable code that would work in my game. This is what I came up with, maybe it can be of some insight.. I'd appreciate any comments. I've left out big chunks of the code that weren't relevent.
Edited by - eotvos on January 10, 2002 6:59:04 PM
|
Edited by - eotvos on January 10, 2002 6:59:04 PM
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement