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:
authorErwin Coumans <blender@erwincoumans.com>2012-12-15 05:01:35 +0400
committerErwin Coumans <blender@erwincoumans.com>2012-12-15 05:01:35 +0400
commit1b37f8dca85578ad2bf5f8202568d00b91d194b8 (patch)
treefd8074f3749a166256a7a75688d07f0fbe272e52 /source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
parent96f6a5cf207c31afefa9faf63bdc76a072cb078c (diff)
Hi there, it has been a while, just curious if my SVN account still works :)
This commit is an attempt to improve collisions between moving Bullet rigid bodies using (concave) triangle mesh bounds. Instead of using Gimpact, this we create a btCompoundShape with child shape tetrahedra derived from the surface triangles. For each triangle, we add a fourth vertex using the centroid, shifting inwards using the triangle normal. If the centroid hits an internal triangle, we stop. The default depth could be exposed as 'advanced' setting in the user interface. This solution will be a slower than the original/gimpact solution, but a bit more reliable. In the future, it is better to add HACD, convex decomposition to Blender, for moving concave meshes. See http://kmamou.blogspot.com and the Bullet SDK's Demos/ConvexDecompositionDemo.
Diffstat (limited to 'source/gameengine/Physics/Bullet/CcdPhysicsController.cpp')
-rw-r--r--source/gameengine/Physics/Bullet/CcdPhysicsController.cpp11
1 files changed, 9 insertions, 2 deletions
diff --git a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
index 6c6ce94d8d5..a1b30ccb001 100644
--- a/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
+++ b/source/gameengine/Physics/Bullet/CcdPhysicsController.cpp
@@ -24,7 +24,7 @@ subject to the following restrictions:
#include "btBulletDynamicsCommon.h"
#include "BulletCollision/CollisionDispatch/btGhostObject.h"
#include "BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h"
-
+#include "BulletCollision/Gimpact/btCompoundFromGimpact.h"
#include "BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h"
#include "PHY_IMotionState.h"
@@ -2169,9 +2169,16 @@ btCollisionShape* CcdShapeConstructionInfo::CreateBulletShape(btScalar margin, b
);
btGImpactMeshShape* gimpactShape = new btGImpactMeshShape(indexVertexArrays);
gimpactShape->setMargin(margin);
- collisionShape = gimpactShape;
gimpactShape->updateBound();
+ //the depth value is how far along the triangle normal, the centroid is moved inwards
+ //to create surface tetrahedra for the btCompoundShape
+ //would be nice to expose this in the Blender user interfaceb
+ btScalar depth=btScalar(0.2);
+ collisionShape = btCreateCompoundFromGimpactShape(gimpactShape,depth);
+ delete gimpactShape;
+
+
} else
{
if (!m_unscaledShape || m_forceReInstance)