Bullet patch for compound ray cast. The patch is filed in Bullet patch tracker for...
[blender-staging.git] / extern / bullet2 / bullet_compound_raycast.patch
1 Index: src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
2 ===================================================================
3 --- src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp  (r\82vision 16464)
4 +++ src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp  (copie de travail)
5 @@ -379,12 +379,16 @@
6                                         btTransform childTrans = compoundShape->getChildTransform(i);
7                                         const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
8                                         btTransform childWorldTrans = colObjWorldTransform * childTrans;
9 +                                       // replace collision shape so that callback can determine the triangle
10 +                                       btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
11 +                                       collisionObject->setCollisionShape((btCollisionShape*)childCollisionShape);
12                                         rayTestSingle(rayFromTrans,rayToTrans,
13                                                 collisionObject,
14                                                 childCollisionShape,
15                                                 childWorldTrans,
16                                                 resultCallback);
17 -
18 +                                       // restore
19 +                                       collisionObject->setCollisionShape(saveCollisionShape);
20                                 }
21                         }
22                 }
23 @@ -571,11 +575,16 @@
24                                         btTransform childTrans = compoundShape->getChildTransform(i);
25                                         const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
26                                         btTransform childWorldTrans = colObjWorldTransform * childTrans;
27 +                                       // replace collision shape so that callback can determine the triangle
28 +                                       btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
29 +                                       collisionObject->setCollisionShape((btCollisionShape*)childCollisionShape);
30                                         objectQuerySingle(castShape, convexFromTrans,convexToTrans,
31                                                 collisionObject,
32                                                 childCollisionShape,
33                                                 childWorldTrans,
34                                                 resultCallback, allowedPenetration);
35 +                                       // restore
36 +                                       collisionObject->setCollisionShape(saveCollisionShape);
37                                 }
38                         }
39                 }