## Convex Hull Penetration

cinnamonghoul
Posts: 3
Joined: Mon Feb 26, 2018 5:54 pm

### Convex Hull Penetration

The btConvexHullShape objects that I create are penetrating other rigid bodies and sinking into their interiors. I have tested this with the btBoxShape and btStaticPlaneShape and got the same result. The below images show how I created a simple tetrahedron with coordinates <0,0,0,>, <1,0,0>, <0,1,0>, <0,0,1> and placed it five meters above the ground dropping it on a box with half extents of <1,1,1>.

convexHull2.png (2.77 KiB) Viewed 666 times
The tet lands on top of the box, but then begins to penetrate its interior and float around as if it were suspended in liquid. This naturally causes the box to shudder due to the corrective force that Bullet applies during penetration.

convexHull1.png (2.79 KiB) Viewed 666 times
I have tried increasing the collision margin (from 0.04 to 0.2), increasing the timestep (1/60 with 1/120 substep), and changing the center of mass (from <0,0,0> to <1/4,1/4,1/4>) but to no avail. Any suggestions as to what I might be doing wrong?

cinnamonghoul
Posts: 3
Joined: Mon Feb 26, 2018 5:54 pm

### Re: Convex Hull Penetration

My code for creating convex hulls:

Code: Select all

``````// p->count/3 == number of vertices
btConvexHullShape* convex = new btConvexHullShape(&points[0].getX(), p->count/3);
convex->optimizeConvexHull();
convex->initializePolyhedralFeatures(1);
convex->setMargin(margin);

// Later in the code ...
// body is btRigidBody created from convex hull
btTransform center = btTransform(*(new btQuaternion(0,0,0)), centerOfMass);
body->setCenterOfMassTransform(center);
``````