I am using the ODE (Open Dynamics Engine) library to simulate physics in my application. To create the bounding box and cylinder geometry I am using the following code
dMass m1;
dMassSetZero(&m1);
dMassSetCappedCylinderTotal(&m1, mass, 2, lx/2.0, lz);
dBodySetMass(body, &m1);
dBodySetPosition(body, x0, y0, z0);
dBodySetRotation(body, R);
dGeomID geom = dCreateCylinder(PhysicsEngine::space, lx / 2.0, lz);
dGeomSetBody(geom, body);
No error is generated, and object is generated correctly. However when performing collision treatment:
const int N = 100;
dContact contact[N];
int n = dCollide(o1, o2, N, &contact[0].geom, sizeof(dContact));
for (int i = 0; i < n; i++) {
contact[i].surface.mode = dContactSlip2 | dContactSlip1;
contact[i].surface.mu = dInfinity;
contact[i].surface.slip1 = 0.1;
contact[i].surface.slip2 = 0.1;
dJointID c = dJointCreateContact(PhysicsEngine::world, PhysicsEngine::contactgroup, &contact[i]);
dJointAttach(c, dGeomGetBody(contact[i].geom.g1), dGeomGetBody(contact[i].geom.g2));
}
The engine recognizes collisions of:
- Plane and Cylinder
- Cube and Cylinder
- Ball and Cylinder
but does not recognize Cylinder with Cylinder, as in the image
Doesanyonehaveanyideawhatitcanbe?Iamusingthecurrentversionofthelibrary,availableinthis repository and I used the following command to compile it
./premake4.exe --with-tests --with-libccd --with-demos vs2010