update Bullet 2.x with latest changes, notice that the integration is not finished...
[blender.git] / extern / bullet2 / src / BulletCollision / CollisionDispatch / btManifoldResult.cpp
index 7031521f66b2297c5677af2f04e4f95e8ec9fa56..1d3941101b25db033f85d24699d9e2d7be04c16a 100644 (file)
@@ -58,7 +58,7 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b
        assert(m_manifoldPtr);
        //order in manifold needs to match
        
-       if (depth > m_manifoldPtr->getContactBreakingTreshold())
+       if (depth > m_manifoldPtr->getContactBreakingThreshold())
                return;
 
        bool isSwapped = m_manifoldPtr->getBody0() != m_body0;
@@ -74,33 +74,28 @@ void btManifoldResult::addContactPoint(const btVector3& normalOnBInWorld,const b
        
 
        int insertIndex = m_manifoldPtr->getCacheEntry(newPt);
-       if (insertIndex >= 0)
-       {
 
-// This is not needed, just use the old info!
-//             const btManifoldPoint& oldPoint = m_manifoldPtr->getContactPoint(insertIndex);
-//             newPt.CopyPersistentInformation(oldPoint);
-//             m_manifoldPtr->replaceContactPoint(newPt,insertIndex);
+       newPt.m_combinedFriction = calculateCombinedFriction(m_body0,m_body1);
+       newPt.m_combinedRestitution = calculateCombinedRestitution(m_body0,m_body1);
 
+       //User can override friction and/or restitution
+       if (gContactAddedCallback &&
+               //and if either of the two bodies requires custom material
+                ((m_body0->m_collisionFlags & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK) ||
+                  (m_body1->m_collisionFlags & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK)))
+       {
+               //experimental feature info, for per-triangle material etc.
+               btCollisionObject* obj0 = isSwapped? m_body1 : m_body0;
+               btCollisionObject* obj1 = isSwapped? m_body0 : m_body1;
+               (*gContactAddedCallback)(newPt,obj0,m_partId0,m_index0,obj1,m_partId1,m_index1);
+       }
 
+       if (insertIndex >= 0)
+       {
+               //const btManifoldPoint& oldPoint = m_manifoldPtr->getContactPoint(insertIndex);
+               m_manifoldPtr->replaceContactPoint(newPt,insertIndex);
        } else
        {
-
-               newPt.m_combinedFriction = calculateCombinedFriction(m_body0,m_body1);
-               newPt.m_combinedRestitution = calculateCombinedRestitution(m_body0,m_body1);
-
-               //User can override friction and/or restitution
-               if (gContactAddedCallback &&
-                       //and if either of the two bodies requires custom material
-                        ((m_body0->m_collisionFlags & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK) ||
-                          (m_body1->m_collisionFlags & btCollisionObject::CF_CUSTOM_MATERIAL_CALLBACK)))
-               {
-                       //experimental feature info, for per-triangle material etc.
-                       btCollisionObject* obj0 = isSwapped? m_body1 : m_body0;
-                       btCollisionObject* obj1 = isSwapped? m_body0 : m_body1;
-                       (*gContactAddedCallback)(newPt,obj0,m_partId0,m_index0,obj1,m_partId1,m_index1);
-               }
-
                m_manifoldPtr->AddManifoldPoint(newPt);
        }
 }