[ODE] Contacts and multiple updates per frame

mucki michael.lacher at hlw.co.at
Thu Nov 11 09:50:57 MST 2004


Hi!

I am writing this in responso to the thread about "Making simulation 
speed independant from computer speed".

Both Megan Fox and Jon Watte replied that the best solution for a stable 
simulation is to use multiple dWordStep() calls with a fixed update time.

I have tried this too, and had good experience in my simulations, 
however I repeatedly ran into problems with contact joints. The problem 
seems to be that ODE behaves badly (sometimes) when a contact joint is 
kept for more than one update (probably because thebodies are already 
seperated again in the later updates ?).

The most accurate solution would of course be:

timeAccum += elapsedTimeSinceLastFrame
while (timeAccum > STEP_SIZE)
{
   collideWorld();
   dWorldStep(STEP_SIZE)
   dJointGroupEmpty(contactgroup);
   timeAccum -= STEP_SIZE
}

however, this brings down the speed to a crawl, as collision takes a lot 
of time.

I also tried a cleaning the contacts after the first step like this:

timeAccum += elapsedTimeSinceLastFrame
collideWorld();
while (timeAccum > STEP_SIZE)
{
   dWorldStep(STEP_SIZE)
   dJointGroupEmpty(contactgroup);
   timeAccum -= STEP_SIZE
}

but this also seems to have problems in some cases.

Of course i also tried the version where the contacts are kept for the 
whole batch of updates, but it has the above mentioned problems. Maybe 
someone with inepth knowledge of how exactly contact joints are handled 
by ODE, and how they interact with the simulation can explain what is 
going on and why, and which of the two faster methods is the better one 
to use (the slower, accurate one beeing out of question for performance 
reasons).

regards,
mucki


More information about the ODE mailing list