From e5fb1aa1d5488af59433b6fe02d5fe12c02ead0a Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Sat, 22 Dec 2018 17:02:58 -0800 Subject: [PATCH] apply improvement, to allow btCompoundShape per-shape collision filtering Fixes old issue 67 --- .../btCompoundCollisionAlgorithm.cpp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp b/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp index e3dda5bfa..633bee482 100644 --- a/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp +++ b/src/BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp @@ -113,6 +113,12 @@ public: const btCompoundShape* compoundShape = static_cast(m_compoundColObjWrap->getCollisionShape()); btAssert(index < compoundShape->getNumChildShapes()); + if (gCompoundChildShapePairCallback) + { + if (!gCompoundChildShapePairCallback(m_otherObjWrap->getCollisionShape(), childShape)) + return; + } + //backup btTransform orgTrans = m_compoundColObjWrap->getWorldTransform(); @@ -130,11 +136,6 @@ public: btVector3 aabbMin1, aabbMax1; m_otherObjWrap->getCollisionShape()->getAabb(m_otherObjWrap->getWorldTransform(), aabbMin1, aabbMax1); - if (gCompoundChildShapePairCallback) - { - if (!gCompoundChildShapePairCallback(m_otherObjWrap->getCollisionShape(), childShape)) - return; - } if (TestAabbAgainstAabb2(aabbMin0, aabbMax0, aabbMin1, aabbMax1)) {