I have a strange problem: Why the thin "btBoxShapeBox" box cannot to be laid flat on the "btConvexHullShape" plane?
The "btConvexHullShape" plane:
Code: Select all
btConvexHullShape* hull = new btConvexHullShape();
const btVector3 v1 = btVector3(0, 0.1, -2);
hull->addPoint(v1);
const btVector3 v2 = btVector3(0, 0.2, -2);
hull->addPoint(v2);
const btVector3 v3 = btVector3(0, 0.1, 2);
hull->addPoint(v3);
const btVector3 v4 = btVector3(0, 0.2, 2);
hull->addPoint(v4);
const btVector3 v5 = btVector3(-5, 0.2, 0);
hull->addPoint(v5);
const btVector3 v6 = btVector3(-5, 0.1, 0);
hull->addPoint(v6);
hull->setMargin(0.02f);
(1) Case 1:
Code: Select all
btBoxShape* boxShape = createBoxShape(btVector3(0.125, 0.018, 0.125));
boxShape->setMargin(0.0);
(2) Case 2:
Code: Select all
btBoxShape* boxShape = createBoxShape(btVector3(0.125, 0.018, 0.125));
boxShape->setMargin(0.04);
This is contradictory! Physical engine suggests to use a positive margin (zero margin might introduce problems), but in this case, positive margin introduced problems.
In fact, I have to create BoxShape with positive margin, so I wonder how to solve this problem when using the positive margin to create BoxShape.
btBoxShape collides with btConvexHullShape calls btConvexConvexAlgorithm class to get the closest points between two convex shapes. I think btConvexConvexAlgorithm class is the cause of this issue.
Thanks!