[ODE] Fixed timestep loop woes

Anders Olofsson anders.olofsson at biologigrand.ac
Mon Dec 12 18:42:43 MST 2005


Hello everyone!,

I've been toying a little with ODE and been using variable timesteps but 
now I'm about to try fixed timestep. I've been backreading on this topic 
and this seems to be the general way of doing it (mostly from carworld):

#define FIXEDSTEP 0.006
float curTime;
void StepODE (float dtime)
{
   static float lastTime = 0;
   curTime += dtime;
   loops=0;
   while(lastTime<curTime){
     lastTime += FIXEDSTEP;
     dSpaceCollide(space, 0, &nearCallback);
     dWorldQuickStep(world, FIXEDSTEP);
     dJointGroupEmpty(contactgroup);
   }
}

Correct, no? It seems to work fine.

But I have also read this: http://www.gaffer.org/articles/Timestep.html

Wich basicly is what I'm doing, except the last thing were the author 
suggest having two states (previous and current) around and interpolating 
between them to get a new state wich is then rendered.

The question I have is: Is anyone doing that with ODE? (The interpolating 
stuff). Having two states I guess means for each body to have two sets of 
positions, velocities, orientations etc? Perhaps using two bodys instead of 
just one and somehow interpolate between those? It feels like allot of 
trouble, is it worth it?

Thanks,

Anders Olofsson






More information about the ODE mailing list