[ODE] (Second Try) Problem with contact joints (SOLVED!)

Rodrigo Hernandez kwizatz at aeongames.com
Thu Mar 24 13:17:16 MST 2005



Well, I seem to finally have found the problem, my dBody's invMass variable 
was too small an amount, probably because of my larger scale, thus,
inside  step.cpp, dInternalStepIsland_x2() line 1656:

for (j=0; j<3; j++) body[i]->lvel[j] += body_invMass * cforce[i*8+j];


body[0]->lvel[2] was getting such a negligible "push" that didn't 
compensate for gravity.

the solution was to remove the lines regarding mass and letting the body 
use the default mass at least while I find more suitable mass settings.

Best Regards.

At 08:50 AM 18/03/2005, you wrote:
>Hi,
>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()
>{
>    dSpaceCollide(ODESpace,0,&ODENearCallback);
>    dWorldStep(ODEWorld,0.01);
>    dJointGroupEmpty(ODEContactGroup);
>}
>
>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]);
>        dJointAttach(c,b1,b2);
>    }
>  }
>}
>
>Thanks for looking :).
>_______________________________________________
>ODE mailing list
>ODE at q12.org
>http://q12.org/mailman/listinfo/ode

Rodrigo Hernandez, lonewolf programmer
Aeon Games
http://www.aeongames.com 



More information about the ODE mailing list