[Bf-blender-cvs] SVN commit: /data/svn/bf-blender [16476] branches/sim_physics/extern/ bullet2: Bullet patch for compound ray cast.
Benoit Bolsee
benoit.bolsee at online.be
Thu Sep 11 22:09:16 CEST 2008
Revision: 16476
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-blender&revision=16476
Author: ben2610
Date: 2008-09-11 22:09:07 +0200 (Thu, 11 Sep 2008)
Log Message:
-----------
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
Modified Paths:
--------------
branches/sim_physics/extern/bullet2/readme.txt
branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
Added Paths:
-----------
branches/sim_physics/extern/bullet2/bullet_compound_raycast.patch
Added: branches/sim_physics/extern/bullet2/bullet_compound_raycast.patch
===================================================================
--- branches/sim_physics/extern/bullet2/bullet_compound_raycast.patch (rev 0)
+++ branches/sim_physics/extern/bullet2/bullet_compound_raycast.patch 2008-09-11 20:09:07 UTC (rev 16476)
@@ -0,0 +1,39 @@
+Index: src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
+===================================================================
+--- src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp (r\x82vision 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);
+ }
+ }
+ }
Modified: branches/sim_physics/extern/bullet2/readme.txt
===================================================================
--- branches/sim_physics/extern/bullet2/readme.txt 2008-09-11 16:50:34 UTC (rev 16475)
+++ branches/sim_physics/extern/bullet2/readme.txt 2008-09-11 20:09:07 UTC (rev 16476)
@@ -1,4 +1,9 @@
+***
+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 ***
This is the new refactored version of Bullet physics library version 2.x
Modified: branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp
===================================================================
--- branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp 2008-09-11 16:50:34 UTC (rev 16475)
+++ branches/sim_physics/extern/bullet2/src/BulletCollision/CollisionDispatch/btCollisionWorld.cpp 2008-09-11 20:09:07 UTC (rev 16476)
@@ -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);
}
}
}
More information about the Bf-blender-cvs
mailing list