[ODE] optimization for disabled objects

Peter twentyseven at urbanterror.net
Sat Sep 18 12:33:22 MST 2004


Hi, I think I've discovered an undocumented and fairly important quirk of
the ode collision callback system regarding autodisable.

What it seems, is even if a body is disabled, the ode collision callback
still passes it's geoms in for evaluation and contact generation.

I have a "world" tri mesh with various stacks of crates and other boxes
scattered around.  The simulation goes to sleep after a couple of frames,
but I was still generating a few hundred contacts per sim step.
Technically, if everything is asleep, there should be zero contacts needed
between two sleeping bodys.

So, a quick fiddle later, this is how my test worked out in the ode
callback:

~~
b1 = dGeomGetBody(o1);
b2 = dGeomGetBody(o2);
~~

//  exit without doing anything if they're both dynamic bodys and both
asleep
   b1awake=0;
   b2awake=0;
   if (b1)
   {
      b1awake=dBodyIsEnabled(b1);
   }
   if (b2)
   {
      b2awake=dBodyIsEnabled(b2);
   }
   if (b1awake==0 && b2awake==0) return;

So as the comment says, it is an early out if both Are Bodys and both bodys
are disabled.

I hope this is both useful and correct, because it seems to give quite a
significant performance increase for me.




More information about the ODE mailing list