[ODE] dAreConnected

Pål- Arve Nilsen conn at smsc.no
Fri Nov 10 06:39:49 MST 2006


I have build a little application from the test code that comes with ode 0.6
When i started to use my own composite geoms, i got problem with my 
collision detection.
After a while i discovered that the error is in the dAreConnect 
function. it returns true if two objects
are connected through a dJointTypeContact.
To me this doesnt make sense, what if a box collied in the corner of a 
composite body, as it is now, only one connection will
be "discovered".
I rewrote the function

int dAreConnected (dBodyID b1, dBodyID b2)
{
  dAASSERT (b1 && b2);
  // look through b1's neighbour list for b2
  for (dxJointNode *n=b1->firstjoint; n; n=n->next)
  {
    if (n->body == b2)
    {
        // Check if the joint is a contactjoint
        if( n->joint->vtable->typenum!== dJointTypeContact )
            return 1;
    }
  }
  return 0;
}


More information about the ODE mailing list