svn merge -r 15988:16055 https://svn.blender.org/svnroot/bf-blender/trunk/blender
This commit is contained in:
@@ -956,13 +956,16 @@ void CcdPhysicsEnvironment::CallbackTriggers()
|
||||
if (m_triggerCallbacks[PHY_OBJECT_RESPONSE] || (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints)))
|
||||
{
|
||||
//walk over all overlapping pairs, and if one of the involved bodies is registered for trigger callback, perform callback
|
||||
int numManifolds = m_dynamicsWorld->getDispatcher()->getNumManifolds();
|
||||
btDispatcher* dispatcher = m_dynamicsWorld->getDispatcher();
|
||||
int numManifolds = dispatcher->getNumManifolds();
|
||||
for (int i=0;i<numManifolds;i++)
|
||||
{
|
||||
btPersistentManifold* manifold = m_dynamicsWorld->getDispatcher()->getManifoldByIndexInternal(i);
|
||||
btPersistentManifold* manifold = dispatcher->getManifoldByIndexInternal(i);
|
||||
int numContacts = manifold->getNumContacts();
|
||||
if (numContacts)
|
||||
{
|
||||
btRigidBody* rb0 = static_cast<btRigidBody*>(manifold->getBody0());
|
||||
btRigidBody* rb1 = static_cast<btRigidBody*>(manifold->getBody1());
|
||||
if (m_debugDrawer && (m_debugDrawer->getDebugMode() & btIDebugDraw::DBG_DrawContactPoints))
|
||||
{
|
||||
for (int j=0;j<numContacts;j++)
|
||||
@@ -973,8 +976,8 @@ void CcdPhysicsEnvironment::CallbackTriggers()
|
||||
m_debugDrawer->drawContactPoint(cp.m_positionWorldOnB,cp.m_normalWorldOnB,cp.getDistance(),cp.getLifeTime(),color);
|
||||
}
|
||||
}
|
||||
btRigidBody* obj0 = static_cast<btRigidBody* >(manifold->getBody0());
|
||||
btRigidBody* obj1 = static_cast<btRigidBody* >(manifold->getBody1());
|
||||
btRigidBody* obj0 = rb0;
|
||||
btRigidBody* obj1 = rb1;
|
||||
|
||||
//m_internalOwner is set in 'addPhysicsController'
|
||||
CcdPhysicsController* ctrl0 = static_cast<CcdPhysicsController*>(obj0->getUserPointer());
|
||||
@@ -991,6 +994,15 @@ void CcdPhysicsEnvironment::CallbackTriggers()
|
||||
m_triggerCallbacks[PHY_OBJECT_RESPONSE](m_triggerCallbacksUserPtrs[PHY_OBJECT_RESPONSE],
|
||||
ctrl0,ctrl1,0);
|
||||
}
|
||||
// Bullet does not refresh the manifold contact point for object without contact response
|
||||
// may need to remove this when a newer Bullet version is integrated
|
||||
if (!dispatcher->needsResponse(rb0, rb1))
|
||||
{
|
||||
// Refresh algorithm fails sometimes when there is penetration
|
||||
// (usuall the case with ghost and sensor objects)
|
||||
// Let's just clear the manifold, in any case, it is recomputed on each frame.
|
||||
manifold->clearManifold(); //refreshContactPoints(rb0->getCenterOfMassTransform(),rb1->getCenterOfMassTransform());
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user