[ODE] (Second Try) Problem with contact joints

Rodrigo Hernandez kwizatz at aeongames.com
Fri Mar 18 08:50:48 MST 2005

Well, I tried to set the step to a smaller amount, my max contacts is 
40, but dCollide returns only one collision, still no change at runtime, 
the sphere just passes through.

I am going to try tracing into ODE's dWorldStep function and find 
whether or not the contact makes any difference, so what is the function 
that applies contact forces? what should I be looking for?

Here is the code for the simloop and the near callback I am using just 
in case.
The Near callback is an object static function, in case you're wondering:

void CWorld::OnPrepare()

void CWorld::ODENearCallback (void *data, dGeomID o1, dGeomID o2)
 CWorld *World=CWorld::GetWorld();
  // 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;

  dContact contact[40];   // up to MAX_CONTACTS contacts per box-box
  for (int i=0; i<40; i++)
    contact[i].surface.mode = dContactBounce | dContactSoftCFM;
    contact[i].surface.mu = dInfinity;
    contact[i].surface.mu2 = 0;
    contact[i].surface.bounce = 1.0f;
    contact[i].surface.bounce_vel = 0.0f;
    contact[i].surface.soft_cfm = 0.01f;
  if (int numc = dCollide (o1,o2,40,&contact[0].geom,sizeof(dContact)))
    for (int i=0; i<numc; ++i)
        dWorldID world = World->GetODEWorld();
        dJointGroupID cg=World->GetODEContactGroup();
        dJointID c = dJointCreateContact (world,cg,&contact[i]);

Thanks for looking :).

More information about the ODE mailing list