[ODE] (Second Try) Problem with contact joints

Kris kris at kolos.math.uni.lodz.pl
Mon Mar 21 11:06:45 MST 2005


Hmmmmm, try decreasing mass to about 4.0, just for test... I've noticed
that heavier objects are more likely to go through trimeshes :P

On Fri, 18 Mar 2005, Rodrigo Hernandez wrote:

> Hi,
>
> Still no luck :(
>
> here is my World creation function:
>
> CSettings::GetSettings()->fGravity is -5.0f
>
> CWorld::CWorld()
> {
>   CurCamera = NULL;
>   sName = "World";
>   ODEWorld = dWorldCreate();
>   ODESpace = dSimpleSpaceCreate(0);
>   ODEContactGroup = dJointGroupCreate (0);
>   dWorldSetGravity(ODEWorld,0,0,CSettings::GetSettings()->fGravity);
>   dWorldSetCFM(ODEWorld,1e-5f);
> }
>
> here is how I create the trimesh, I highly doubt the problem is here though.
>
>     ODETriMeshData = dGeomTriMeshDataCreate();
>
>     dGeomTriMeshDataBuildSimple(ODETriMeshData, (dReal*)ODEVertices,
> VertexCount, ODEIndices, IndexCount);
>
>     ODETriMesh =
> dCreateTriMesh(CWorld::GetWorld()->GetODEWorldSpace(),ODETriMeshData, 0,
> 0, 0);
>
> Finally here is my sphere creation code:
>
> CEntity::CEntity()
> {
>   // ODE Stuff
>     dMatrix3 Rotation;
>     dMass Mass;
>     dRSetIdentity(Rotation);
>     CWorld *World=CWorld::GetWorld();
>     ODEBody = dBodyCreate(World->GetODEWorld());
>     dBodySetPosition (ODEBody,0.0f,0.0f,0.0f);
>     dBodySetRotation (ODEBody,Rotation);
>     dBodySetData (ODEBody,(void*)NULL);
>     dMassSetSphere (&Mass,5.0f,87.5f);
>     ODEGeometry=dCreateSphere(World->GetODEWorldSpace(),87.5f);
>     dGeomSetBody(ODEGeometry,ODEBody);
>     dBodySetMass(ODEBody,&Mass);
>     dBodySetPosition (ODEBody,200.0f,200.0f,500.0f);
> }
>
> Thanks again.
>
> Kris wrote:
>
> >Hi
> >
> >try those settings, it it sill won't work properly you can be sure that
> >parameters are ok :D
> >
> >		 contact[i].surface.mode = dContactBounce | dContactSoftERP | dContactSoftCFM | dContactApprox1;
> >                 contact[i].surface.mu = 0.7f;
> >                 contact[i].surface.bounce = 0.01f;
> >                 contact[i].surface.slip1 = 0.2;
> >                 contact[i].surface.slip2 = 0.2;
> >                 contact[i].surface.soft_erp = 0.7f;
> >                 contact[i].surface.soft_cfm = 0.001f;
> >
> >maybe you have put sphere into another space, then you have to call
> >dSpaceCollide2, for now i'm running out of ideas...
> >
> >On Fri, 18 Mar 2005, Rodrigo Hernandez 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
> >>
> >>
> >>
> >
> >Pozdr __DEVELOPER_TRINITY_CREEZ_H__
> >
> >
>
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode
>

Pozdr __DEVELOPER_TRINITY_CREEZ_H__
-- 
===========================================
                 GG: 1271378
-------------[ PROJECT TRINITY ]-----------
  [ http://trinity.glt.pl ]   [ Trinity ]
        [ The post-nuclear cRPG ]
===========================================



More information about the ODE mailing list