how 2 make dWorldQuickStep run at a constant rate

as using ode & programming c++ is an requirement in the project i’m working on, dWorldQuickStep is used 2 calculate the projectile position in the world. However it occured 2 me tat dWorldQuickStep runs at its own rate with no regards 2 de game world time. does anyone noe how 2 overcome this prob?

Getting ODE to work at a variable frame rate is tricky and can lead to instability, so I’d recommend manually limiting the frame rate of Python to match the rate used by ODE (or some multiple of it, in case you want to run multiple ODE steps per video frame).

I haven’t done this specifically in Panda, but if you determine the time and the beginning and end of each Panda game loop iteration you can determine how long that loop took, and then you can just sleep for the difference between that time and the desired frame time. Note that if Panda runs slower than the desired frame time then the game will run slowly, however the ODE simulation will remain stable.

You can simply put:

clock-mode limited
clock-frame-rate 20

in your Config.prc to limit Panda to run no faster than 20fps (or whatever frame rate you specify). Basically, this will ask Panda to wait for 1/20 sec to elapse, if necessary, before returning from renderFrame().

Note that your game might run slower than this speed, depending on your scene and your Python code.


thx, manage 2 make it work.