[ODE] Performance patch : not checking collision between disabled
bodies
Konstantin Slipchenko
slipch at gsc-game.kiev.ua
Wed May 26 15:38:25 MST 2004
Hello Nguyen,
Wednesday, May 26, 2004, 12:33:35 PM, you wrote:
Imagine a stack of small boxes which are already disabled.
Another big box touche them simultaneously from stack side.
As far as only the big box was enabled during colliding we create
contacts between big box and small boxes but do not create contacts
between small boxes. While WorldStep all boxes will be enabled and
boxes in the stack start to fall knowing nothing about each other and
static environment. If we have not too small stepsize and world
gravity the stack would explode in this case.
Colliding:
______
[disabled]| |
[disabled]|enabed|
[disabled]| |
[disabled]|______|
WorldStep
______
[enabed]| |
[enabed]|enabed|
[enabed]| |
[enabed]|______|
................
NB> static void collideAABBs (dxGeom *g1, dxGeom *g2,
NB> void *data, dNearCallback *callback)
NB> {
NB> dIASSERT((g1->gflags & GEOM_AABB_BAD)==0);
NB> dIASSERT((g2->gflags & GEOM_AABB_BAD)==0);
NB> // no contacts if both geoms on the same body, and the body is not 0
NB> if (g1->body == g2->body && g1->body) return;
NB> // Add those lines
NB> // no collision between geom of disable body
NB> if (g1->body == 0) // g2->body must be != 0 and must not be disable
NB> {
NB> if ((g2->body->flags & dxBodyDisabled)!=0)
NB> {
NB> return;
NB> }
NB> }
NB> else if (g2->body == 0) // g2->body must be != 0 and must not be disable
NB> {
NB> if ((g1->body->flags & dxBodyDisabled)!=0)
NB> {
NB> return;
NB> }
NB> }
NB> else
NB> {
NB> // two bodies are valid
NB> if (((g2->body->flags & dxBodyDisabled)!=0)
NB> && ((g1->body->flags & dxBodyDisabled)!=0))
NB> {
NB> // two bodies are disable so don't bother collide them
NB> return;
NB> }
NB> }
NB> // End add code
NB> // test if the category and collide bitfields match
NB> if ( ((g1->category_bits & g2->collide_bits) ||
NB> (g2->category_bits & g1->collide_bits)) == 0) {
NB> return;
NB> }
NB> This patch comes with new auto-disable method will boost ODE
NB> performance in many real life cases.
--
Best regards,
Konstantin mailto:slipch at gsc-game.kiev.ua
More information about the ODE
mailing list