Fixing [#32210] "Character physics type colliding with sensor type" reported by Danie...
authorMitchell Stokes <mogurijin@gmail.com>
Mon, 30 Jul 2012 03:45:15 +0000 (03:45 +0000)
committerMitchell Stokes <mogurijin@gmail.com>
Mon, 30 Jul 2012 03:45:15 +0000 (03:45 +0000)
extern/bullet2/patches/ghost_character.patch [new file with mode: 0644]
extern/bullet2/readme.txt
extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp

diff --git a/extern/bullet2/patches/ghost_character.patch b/extern/bullet2/patches/ghost_character.patch
new file mode 100644 (file)
index 0000000..d4098cb
--- /dev/null
@@ -0,0 +1,28 @@
+Index: extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp
+===================================================================
+--- extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp     (revision 49183)
++++ extern/bullet2/src/BulletDynamics/Character/btKinematicCharacterController.cpp     (working copy)
+@@ -77,6 +77,9 @@
+               if (convexResult.m_hitCollisionObject == m_me)
+                       return btScalar(1.0);
++              if (!convexResult.m_hitCollisionObject->hasContactResponse())
++                      return btScalar(1.0);
++
+               btVector3 hitNormalWorld;
+               if (normalInWorldSpace)
+               {
+@@ -173,7 +176,12 @@
+               m_manifoldArray.resize(0);
+               btBroadphasePair* collisionPair = &m_ghostObject->getOverlappingPairCache()->getOverlappingPairArray()[i];
+-              
++              btCollisionObject* obj0 = static_cast<btCollisionObject*>(collisionPair->m_pProxy0->m_clientObject);
++              btCollisionObject* obj1 = static_cast<btCollisionObject*>(collisionPair->m_pProxy1->m_clientObject);
++
++              if ((obj0 && !obj0->hasContactResponse()) || (obj1 && !obj1->hasContactResponse()))
++                      continue;
++
+               if (collisionPair->m_algorithm)
+                       collisionPair->m_algorithm->getAllContactManifolds(m_manifoldArray);
index e537ac26189ffcc3ee1fd69e9abc2d25cd1075b2..343cb104c4d017ee52f31ff8364d2b302b4bcd38 100644 (file)
@@ -13,3 +13,7 @@ Originally committed in blender svn revision: 45908.
 Apply patches/make_id.patch to prevent duplicated define of MAKE_ID macro in blender
 side and bullet side.
 Sergey
+
+Apply patches/ghost_character.path to prevent characters from colliding with ghost objects.
+Mitchell
+
index f733dc0cd226fd3474beb6dd32f7ce8dd4775b9a..5fd4ee285113bfaef7d309a6827e28f4dcc16c48 100644 (file)
@@ -77,6 +77,9 @@ public:
                if (convexResult.m_hitCollisionObject == m_me)
                        return btScalar(1.0);
 
+               if (!convexResult.m_hitCollisionObject->hasContactResponse())
+                       return btScalar(1.0);
+
                btVector3 hitNormalWorld;
                if (normalInWorldSpace)
                {
@@ -173,7 +176,12 @@ bool btKinematicCharacterController::recoverFromPenetration ( btCollisionWorld*
                m_manifoldArray.resize(0);
 
                btBroadphasePair* collisionPair = &m_ghostObject->getOverlappingPairCache()->getOverlappingPairArray()[i];
-               
+               btCollisionObject* obj0 = static_cast<btCollisionObject*>(collisionPair->m_pProxy0->m_clientObject);
+               btCollisionObject* obj1 = static_cast<btCollisionObject*>(collisionPair->m_pProxy1->m_clientObject);
+
+               if ((obj0 && !obj0->hasContactResponse()) || (obj1 && !obj1->hasContactResponse()))
+                       continue;
+
                if (collisionPair->m_algorithm)
                        collisionPair->m_algorithm->getAllContactManifolds(m_manifoldArray);