fixed sphere-sphere collision: contact points were not properly removed/refreshed.
authorErwin Coumans <blender@erwincoumans.com>
Sat, 20 Sep 2008 22:34:54 +0000 (22:34 +0000)
committerErwin Coumans <blender@erwincoumans.com>
Sat, 20 Sep 2008 22:34:54 +0000 (22:34 +0000)
extern/bullet2/src/BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp

index c9256473c00ce956c7c3617b16798d1dd95e6dd9..c2b13f5903ff7334cdc3f682e21218059ee22778 100644 (file)
@@ -56,11 +56,16 @@ void btSphereSphereCollisionAlgorithm::processCollision (btCollisionObject* col0
        btScalar radius0 = sphere0->getRadius();
        btScalar radius1 = sphere1->getRadius();
 
        btScalar radius0 = sphere0->getRadius();
        btScalar radius1 = sphere1->getRadius();
 
-       //m_manifoldPtr->clearManifold(); //don't do this, it disables warmstarting
+#ifdef CLEAR_MANIFOLD
+       m_manifoldPtr->clearManifold(); //don't do this, it disables warmstarting
+#endif
 
        ///iff distance positive, don't generate a new contact
        if ( len > (radius0+radius1))
        {
 
        ///iff distance positive, don't generate a new contact
        if ( len > (radius0+radius1))
        {
+#ifndef CLEAR_MANIFOLD
+               resultOut->refreshContactPoints();
+#endif //CLEAR_MANIFOLD
                return;
        }
        ///distance (negative means penetration)
                return;
        }
        ///distance (negative means penetration)
@@ -82,7 +87,9 @@ void btSphereSphereCollisionAlgorithm::processCollision (btCollisionObject* col0
        
        resultOut->addContactPoint(normalOnSurfaceB,pos1,dist);
 
        
        resultOut->addContactPoint(normalOnSurfaceB,pos1,dist);
 
-       //no resultOut->refreshContactPoints(); needed, because of clearManifold (all points are new)
+#ifndef CLEAR_MANIFOLD
+       resultOut->refreshContactPoints();
+#endif //CLEAR_MANIFOLD
 
 }
 
 
 }