[ODE] Cylinder Collision
Grant James
ultimatezeus at hotmail.com
Thu Nov 18 23:24:57 MST 2004
Hi,
I have created a simple program where shapes fall from the sky and land on a
surface. Boxes and spheres work perfectly.
If I make the surface a plane, cylinders work but I do not want it to be a
plane as I just want to have a finite surface. If I make this a box :
ground = dCreateBox(spaceID, FLOORSIZE, 0.2, FLOORSIZE);
dGeomSetPosition(ground, 0.0, -3.0, 0.0);
then the cylinders collide properly but when they come to rest, they start
sinking through the surface.
My collision method is as follows :
dBodyID b1 = dGeomGetBody(o1);
dBodyID b2 = dGeomGetBody(o2);
if (b1 && b2 && dAreConnectedExcluding(b1, b2, dJointTypeContact))
return;
dContact contacts[MAX_CONTACTS];
for (int i = 0; i < MAX_CONTACTS; i++)
{
contacts[i].surface.mode = dContactBounce;
contacts[i].surface.mu = dInfinity;
contacts[i].surface.mu2 = 0;
contacts[i].surface.bounce = 0.2;
contacts[i].surface.bounce_vel = 0.01;
contacts[i].surface.soft_cfm = 0.0;
contacts[i].surface.soft_erp = 1.0;
}
int numCollisions = 0;
numCollisions = dCollide(o1, o2, MAX_CONTACTS, &contacts[0].geom,
sizeof(dContact));
for (int i = 0; i < numCollisions; i++)
{
dJointID jointID = dJointCreateContact(worldID, contactGroupID,
&contacts[i]);
dJointAttach(jointID, b1, b2);
}
Is there anyway to specify that the surface must not accept any
penetrations.
Thanks,
Grant
_________________________________________________________________
Make an end to annoying pop-ups with MSN Toolbar!
http://toolbar.msn.co.za?DI=1054&XAPID=2083
More information about the ODE
mailing list