Expose the multi-point perturbation algorithm for btConvexPlaneCollisionAlgorithm

Usage:
	m_collisionConfiguration = new btDefaultCollisionConfiguration();
	m_collisionConfiguration->setPlaneConvexMultipointIterations();

It is only enabled for polyhedral convex shapes, because implicit/smooth surfaces such as spheres, cylinders, capsules and cones keep on rolling forever, due to the extra off-center contact points
This commit is contained in:
erwin.coumans
2011-09-14 20:38:33 +00:00
parent 9abcd9cf2e
commit 385933b5ed
3 changed files with 13 additions and 1 deletions

View File

@@ -127,7 +127,10 @@ void btConvexPlaneCollisionAlgorithm::processCollision (btCollisionObject* body0
resultOut->addContactPoint(normalOnSurfaceB,pOnB,distance);
}
if (resultOut->getPersistentManifold()->getNumContacts()<m_minimumPointsPerturbationThreshold)
//the perturbation algorithm doesn't work well with implicit surfaces such as spheres, cylinder and cones:
//they keep on rolling forever because of the additional off-center contact points
//so only enable the feature for polyhedral shapes (btBoxShape, btConvexHullShape etc)
if (convexShape->isPolyhedral() && resultOut->getPersistentManifold()->getNumContacts()<m_minimumPointsPerturbationThreshold)
{
btVector3 v0,v1;
btPlaneSpace1(planeNormal,v0,v1);