[ODE] auto-disable patch (yet again)

Aras Pranckevicius nearaz at interamotion.com
Thu Apr 22 12:51:22 MST 2004


>   * i changed the auto-disable code a bit: you might want to verify
that
>     my changes make sense.

It seems that a call to dInternalHandleAutoDisabling is missing from the
actual StepFast code (it is in the function processIslandsFast that
isn't used by default, and it's missing in processIslandsFast that's
used by default).

> the test_boxstack demo has been modified (a one line change!) to
> auto-disable its bodies. disabled bodies display as red ... try it,
it's
> fun!

Yes :)

> there are two big issues still to resolve with auto-disabling:
>   * we shouldn't be doing collision work for disabled bodies.

A quick and easy one is to do this in your collision callback (eg. for
test-boxstack):
// -----------------
static void nearCallback (void *data, dGeomID o1, dGeomID o2) {
  // usual stuff...
  // exit without doing anything if the two bodies are connected by a
joint
  dBodyID b1 = dGeomGetBody(o1);
  dBodyID b2 = dGeomGetBody(o2);
  if (b1 && b2 && dAreConnectedExcluding (b1,b2,dJointTypeContact))
return;

  // take care of disabled bodies
  if( b1 && !b2 && !dBodyIsEnabled(b1) )
   return; // b1 is disabled and collides with no-body
  if( b2 && !b1 && !dBodyIsEnabled(b2) )
    return; // b2 is disabled and collides with no-body
  if( b1 && b2 && !dBodyIsEnabled(b1) && !dBodyIsEnabled(b2) )
   return; // both b1 and b2 are disabled

  // the rest of code...
// -----------------

This way, collision checks for disabled-vs-staticgeom and
disabled-vs-disabled are skipped. AABB tests aren't, though, so it may
be worth doing earlier...


Aras Pranckevicius aka NeARAZ
http://www.gim.ktu.lt/nesnausk/nearaz/



More information about the ODE mailing list