[ODE]WorldStep - FrameRate

Adam D. Moss adam at gimp.org
Thu Dec 4 17:44:10 MST 2003


Lukas Henschke wrote:
 > I always thought that ode brings its own timer with it as I saw the
 > timer.cpp in the sourcecode. So I thought the simulation is independet
 > of the framerate.

Well, yes and no.  It's independant of framerate in the sense
that it doesn't know about framerate.  But it's up to YOU to call
it often enough and with the correct (and appropriate) timestep
value.  ODE has no idea what the time is besides what you tell
it by the accumulation of the timestep values you specify.

 > But what I am stumbling about is that my racecar
 > drastically decelerates when i drive around the corner and my framerate
 > drowps from 100fps to 30fps due to the level-geometry. And isn´t the
 > stepsize only a degree of accuracy and not a degree of speed ?

It's related to speed in that simulations with higher-speed (in
relation to size) objects typically require greater accuracy.

 > But when
 > I alter the stepsize my car drives and falls in slow-motion and I have
 > to adjust almost every parameter. So how do I make a simulation that is
 > independent of the framerate. When I set my time_diff as the stepsize
 > the whole thing gets very unstable when the framerate drops.

You are free to perform collision+simulation more than once per frame
-- so if a frame takes twice as long as usual, do c+s twice at the
end of that frame, using the nominal-single-step duration that you
would usually use for each timestep.  This keeps all simulation step
durations within your desired accurate margins.

I accumulate frame time and perform a fixed c+s timestep once for
every 'whole' timestep duration that accumulates.  This works well.

--Adam
-- 
Adam D. Moss   . ,,^^   adam at gimp.org   http://www.foxbox.org/   co:3
Consume Less, Live More



More information about the ODE mailing list