diff options
author | erwin.coumans <erwin.coumans@08e121b0-ae19-0410-a57b-3be3395fd4fd> | 2011-09-14 20:38:33 +0000 |
---|---|---|
committer | erwin.coumans <erwin.coumans@08e121b0-ae19-0410-a57b-3be3395fd4fd> | 2011-09-14 20:38:33 +0000 |
commit | 385933b5ed7095c6fa0a4e4b561c767fd85a5a37 (patch) | |
tree | 9c8791bb73829f841baf68037b2f20284034b0b5 /src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp | |
parent | 9abcd9cf2e19be9eb454f6db7890ce6d0a6c5ed4 (diff) | |
download | bullet3-385933b5ed7095c6fa0a4e4b561c767fd85a5a37.tar.gz |
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
Diffstat (limited to 'src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp')
-rw-r--r-- | src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp b/src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp index 85a8a4e8f..b2e9bfaf5 100644 --- a/src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp +++ b/src/BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp @@ -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); |