[ODE] dWorldStep() on non constant frame rate

Vianney Lecroart lecroart at noos.fr
Mon Dec 16 14:37:01 2002


Hello,

I use your great physics engine for a little game I made. I have a
really strange problem, my loop is like that:

While (true)
{
   newframe = currentime;
   dt = lasttime-newtime;
   lastframe = newframe;
   dWorldStep(dt);
   sleep(100);
}

But the server, sometime slowdown a lot and the dt can be 100ms and some
time, it near 300ms for one or 2 loops. So we call dWorldStep with 0.3.
I think it s the good way to do but in all samples you set the
dWorldStep with a constant value, so it s means that it s frame rate
depend (0.05). No? It means that if the framerate is 50ms, the physics
step is 50ms, the rendering is as fast as the realtime, but if the
framerate is 5ms, the physics will go 10 times faster than the realtime.
Is is correct?

I don't really know the good way to manage the problem to manage
variable framerate.

Thanks for you help.

Vianney Lecroart