[ODE] Collision callback problems
maddocks@metservice.com
maddocks at metservice.com
Mon Aug 5 21:19:01 2002
I've been handling collision testing in my car sim by iterating through
my wheels and calling dCollide on each against a ground plane. I've
decided to change to using the nearCallback but I'm having some
problems. My call back is as follows...
void Practice::CollisionCallback( dGeomID o1, dGeomID o2)
{
dBodyID body1 = dGeomGetBody( o1);
dBodyID body2 = dGeomGetBody( o2);
if( body1 && body2)
{
if( dAreConnected( body1, body2))
{
return;
}
}
const unsigned int CONTACTS = 10;
dContact contact[CONTACTS];
int n = dCollide( o1, o2, CONTACTS, &contact[0].geom,
sizeof(dContact));
for( int i = 0; i < n; ++i)
{
contact[i].surface.mode = dContactBounce | dContactSlip1 |
dContactSlip2;
contact[i].surface.mu = 5000;
contact[i].surface.slip1 = 0.0001;
contact[i].surface.slip2 = 0.0001;
contact[i].surface.bounce = 0.1;
contact[i].surface.bounce_vel = 0.01;
dJointID c = dJointCreateContact( odeWorld->id(),
odeJointGroup->id(), &contact[i]);
dJointAttach( c, dGeomGetBody(contact[i].geom.g1),
dGeomGetBody(contact[i].geom.g2));
}
}
When I run this the wheels of the car are pushed horizontally away from
the car body. The problem appears to be that I'm getting collisions
between the car body and the wheels despite explicitly rejecting them.
The wheels are connected to the body with Hinge2 joints.
Can anyone shed some light on what might be going wrong or how I should
debug it?
Henry
Try not. Do or do not. There is no try. Yoda,Jedi Master