[ODE] Do you have to use constant time steps?

Adam D. Moss aspirin at ntlworld.com
Thu Jun 19 04:32:02 2003


Ed Resnick wrote:
> In the examples, the time step is set to 0.05 -- a constant value. Is this important?

I share your pain, but basically I believe that ODE does indeed
expect constant timesteps, as some of its integration is
implicit (is that so in general, or only with stepfast?).

Two ways for this to cause less pain:

1) Define an upper limit on the number of physics steps to take
per second, accumulate time every frame and take any whole steps
for the accumulated period, subtracting them out of the period
again.  This lets the frame rate naturally vary while keeping
the step (and average number of steps per second) constant, though
it may entail more than a single (or no!) physics step occurring
for a frame.

2) Use a variable timestep, but adjust it very slowly as the
frame rate changes, rather than locking it to the real frame rate.
This would dampen the errors from the non-constant frame rate
and also iron out any spikes.

Regards,
--Adam
-- 
Adam D. Moss   . ,,^^   adam@gimp.org   http://www.foxbox.org/   co:3
"Responsible parents don't raise kids in West Virginia."