[ODE] collion body vs geom

slipch slipch at gsc-game.kiev.ua
Mon Jan 12 20:43:12 MST 2004


Hello Samuel,

Saturday, January 10, 2004, 1:07:46 PM, you wrote:



sg> You are right, so  is there a simple solution to achieve what I'd like to
sg> do.

There must be several different solutions of your problem.
If geometry attached to geometry transform in nearCallback function o1 (o2)
would point to geometry transform object.
If geometry is inserted into space (geometry group) then o1 (o2) would
point to the space. So, in the case of geometry transform simply compare o1(o2) with
transform object. But it is not your case I think.
Suppose you insert wall in some static environment group(space). First
solution is not insert it in the group :).
Another possible solution:
 Suppose there is a loop in your NearCalback after Collide call where contact joints are
 created. Then you may write something like this

....................................
static dContact contacts[N];

// get the contacts up to a maximum of N contacts
  ULONG n;
 .............
n = dCollide(o1, o2, N, &contacts[0].geom, sizeof(dContact));
................................
for(i = 0; i < n; ++i)
{
...........................
dBodyID b1 = dGeomGetBody(contacts[i].geom.g1);
dBodyID b2 = dGeomGetBody(contacts[i].geom.g2);

 if(b1==body[1] && o2==wall ) continue ;
 if(o1==wall &&  b2==body[1] ) continue ;
 
 dJointID contact_joint = dJointCreateContact(phWorld, ContactGroup, &contacts[i]);
 dJointAttach(contact_joint, b1, b2);
 
}

 This code must work in any case.
-- 
Best regards,
 Konstantin  Slipchenko                          mailto:slipch at gsc-game.kiev.ua



More information about the ODE mailing list