Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBenoit Bolsee <benoit.bolsee@online.be>2008-09-12 00:09:07 +0400
committerBenoit Bolsee <benoit.bolsee@online.be>2008-09-12 00:09:07 +0400
commit13b0cf94d5da4cf96607ea8736fad6ae3ab68a4f (patch)
tree81b2a4d2a07645052e176a6ca4054c22d286d7c7
parentc40fe7b2550224423ad6a4472835dacfa6ee44c4 (diff)
Bullet patch for compound ray cast. The patch is filed in Bullet patch tracker for inclusion in later revision. If it is not included, apply manually extern/bullet2/bullet_compound_raycast.patch
-rw-r--r--extern/bullet2/bullet_compound_raycast.patch39
-rw-r--r--extern/bullet2/readme.txt5
-rw-r--r--extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp11
3 files changed, 54 insertions, 1 deletions
diff --git a/extern/bullet2/bullet_compound_raycast.patch b/extern/bullet2/bullet_compound_raycast.patch
new file mode 100644
index 00000000000..2658f7ed56e
--- /dev/null
+++ b/extern/bullet2/bullet_compound_raycast.patch
@@ -0,0 +1,39 @@
+Index: src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
+===================================================================
+--- src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp (r‚vision 16464)
++++ src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp (copie de travail)
+@@ -379,12 +379,16 @@
+ btTransform childTrans = compoundShape->getChildTransform(i);
+ const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
+ btTransform childWorldTrans = colObjWorldTransform * childTrans;
++ // replace collision shape so that callback can determine the triangle
++ btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
++ collisionObject->setCollisionShape((btCollisionShape*)childCollisionShape);
+ rayTestSingle(rayFromTrans,rayToTrans,
+ collisionObject,
+ childCollisionShape,
+ childWorldTrans,
+ resultCallback);
+-
++ // restore
++ collisionObject->setCollisionShape(saveCollisionShape);
+ }
+ }
+ }
+@@ -571,11 +575,16 @@
+ btTransform childTrans = compoundShape->getChildTransform(i);
+ const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
+ btTransform childWorldTrans = colObjWorldTransform * childTrans;
++ // replace collision shape so that callback can determine the triangle
++ btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
++ collisionObject->setCollisionShape((btCollisionShape*)childCollisionShape);
+ objectQuerySingle(castShape, convexFromTrans,convexToTrans,
+ collisionObject,
+ childCollisionShape,
+ childWorldTrans,
+ resultCallback, allowedPenetration);
++ // restore
++ collisionObject->setCollisionShape(saveCollisionShape);
+ }
+ }
+ }
diff --git a/extern/bullet2/readme.txt b/extern/bullet2/readme.txt
index 4d1a4c11706..02430cb5c0e 100644
--- a/extern/bullet2/readme.txt
+++ b/extern/bullet2/readme.txt
@@ -1,3 +1,8 @@
+***
+Apply bullet_compound_raycast.patch if not already applied in Bullet source
+This patch is needed to return correct raycast results on compound shape.
+/ben
+
*** These files in extern/bullet2 are NOT part of the Blender build yet ***
diff --git a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
index 7c2ecd6098a..2fd972a4761 100644
--- a/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
+++ b/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
@@ -379,12 +379,16 @@ void btCollisionWorld::rayTestSingle(const btTransform& rayFromTrans,const btTra
btTransform childTrans = compoundShape->getChildTransform(i);
const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
btTransform childWorldTrans = colObjWorldTransform * childTrans;
+ // replace collision shape so that callback can determine the triangle
+ btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
+ collisionObject->setCollisionShape((btCollisionShape*)childCollisionShape);
rayTestSingle(rayFromTrans,rayToTrans,
collisionObject,
childCollisionShape,
childWorldTrans,
resultCallback);
-
+ // restore
+ collisionObject->setCollisionShape(saveCollisionShape);
}
}
}
@@ -571,11 +575,16 @@ void btCollisionWorld::objectQuerySingle(const btConvexShape* castShape,const bt
btTransform childTrans = compoundShape->getChildTransform(i);
const btCollisionShape* childCollisionShape = compoundShape->getChildShape(i);
btTransform childWorldTrans = colObjWorldTransform * childTrans;
+ // replace collision shape so that callback can determine the triangle
+ btCollisionShape* saveCollisionShape = collisionObject->getCollisionShape();
+ collisionObject->setCollisionShape((btCollisionShape*)childCollisionShape);
objectQuerySingle(castShape, convexFromTrans,convexToTrans,
collisionObject,
childCollisionShape,
childWorldTrans,
resultCallback, allowedPenetration);
+ // restore
+ collisionObject->setCollisionShape(saveCollisionShape);
}
}
}