[ODE] Stepsizes and framerates

Nate W coding at natew.com
Fri Dec 13 10:35:02 2002


On Fri, 13 Dec 2002, Anders Olofsson wrote:

> Need some advice on stepsizes.. I'm timing how long time a loop is
> (rendering+simulation) and then sending that time as stepsize to
> dWorldStep().. This is done to keep the simulation running at correct
> speed. When the framerate goes down, objects needs to move faster and
> so on..
> 
> Is that the proper way to do it?. It works fairly ok, its just that
> when framerates are low objects doesn't come to rest easily as when
> the framerate is high.

That's pretty much the method I'm using, but the elapsed time is clamped
between 1 and 15 milliseconds.  A minimum of 1 prevents divide-by-zero
errors, and a maximum of 15 prevents the instabilities that come with long
step sizes.  One problem with this approach is that the simulation slows
down when the true elapsed time exceeds 15ms.  With LOTS of joints (e.g. a
centipede) the simulations gets very slow.  But for my purposes,
slow-and-stable is preferable to real-time-but-unstable.

-- 

Nate Waddoups
Redmond WA USA
http://www.natew.com