Hello,
is there a "good way" to update physics in the game loop ? I've heard about framerate dependent/independent methods, and honestly i'm a little lost.
For example :
//Main
DWORD time1, time2;
float deltaTime;
time1 = g_timer->getTickCount();
while(message.message != WM_QUIT )
{
time2 = g_timer->getTickCount();
gameLoop((float)(time2 - time1) / 1000);
time1 = time2;
}
In gameLoop I call updatePhysics(elapsedTime) every time.
Of course elapsedTime = (float)(time2 - time1) / 1000
In updatePhysics a rotation look like that :
//rotate tt 25 radians
tt->setPitch(tt->getPitch() - 25.0f * elapsedTime);
For every physic calculation I'll use elapsedTime. Is it the good way to go ?
Thanks, I must know before writing too much code in a wrong way.