[ODE] optimization for disabled objects
Erin Catto
erincatto at sbcglobal.net
Fri Sep 17 21:43:20 MST 2004
If you have a stack of two boxes and the bottom one goes to sleep, then they
will begin falling because the top box must be supported (indirectly) by the
ground.
Erin
-----Original Message-----
From: ode-bounces at q12.org [mailto:ode-bounces at q12.org] On Behalf Of Peter
Sent: Friday, September 17, 2004 7:33 PM
To: ode at q12.org
Subject: [ODE] optimization for disabled objects
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.
_______________________________________________
ODE mailing list
ODE at q12.org
http://q12.org/mailman/listinfo/ode
More information about the ODE
mailing list