diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-04-11 09:57:30 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-04-11 09:57:30 +0400 |
commit | 8dbe14b70b427ff449e1f4a7bb4cff989100f629 (patch) | |
tree | 3b3269edd4aa45acf07bf3fdb75ffcac9f2bb3ab /extern | |
parent | e9d4518c3aae5850ec6c3ae925411c903daee431 (diff) |
applied Charlies patch, reverted some GLSL shader stuff, improved penetration depth estimate.
Diffstat (limited to 'extern')
-rw-r--r-- | extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.cpp | 28 |
1 files changed, 20 insertions, 8 deletions
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.cpp index 23b92c63792..15ff6c788fe 100644 --- a/extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.cpp +++ b/extern/bullet/Bullet/NarrowPhaseCollision/MinkowskiPenetrationDepthSolver.cpp @@ -97,25 +97,27 @@ bool MinkowskiPenetrationDepthSolver::CalcPenDepth(SimplexSolverInterface& simpl ) { - //just take fixed number of orientation, and sample the penetration depth in that direction float minProj = 1e30f; SimdVector3 minNorm; SimdVector3 minVertex; SimdVector3 minA,minB; + SimdVector3 seperatingAxisInA,seperatingAxisInB; + SimdVector3 pInA,qInB,pWorld,qWorld,w; + for (int i=0;i<NUM_UNITSPHERE_POINTS;i++) { const SimdVector3& norm = sPenetrationDirections[i]; - SimdVector3 seperatingAxisInA = (-norm)* transA.getBasis(); - SimdVector3 seperatingAxisInB = norm* transB.getBasis(); + seperatingAxisInA = (-norm)* transA.getBasis(); + seperatingAxisInB = norm* transB.getBasis(); - SimdVector3 pInA = convexA->LocalGetSupportingVertex(seperatingAxisInA); - SimdVector3 qInB = convexB->LocalGetSupportingVertex(seperatingAxisInB); - SimdPoint3 pWorld = transA(pInA); - SimdPoint3 qWorld = transB(qInB); + pInA = convexA->LocalGetSupportingVertexWithoutMargin(seperatingAxisInA); + qInB = convexB->LocalGetSupportingVertexWithoutMargin(seperatingAxisInB); + pWorld = transA(pInA); + qWorld = transB(qInB); - SimdVector3 w = qWorld - pWorld; + w = qWorld - pWorld; float delta = norm.dot(w); //find smallest delta @@ -128,6 +130,16 @@ bool MinkowskiPenetrationDepthSolver::CalcPenDepth(SimplexSolverInterface& simpl } } + + //add the margins + + minA += minNorm*convexA->GetMargin(); + minB -= minNorm*convexB->GetMargin(); + minProj += (convexA->GetMargin() + convexB->GetMargin()); + + + + //#define DEBUG_DRAW 1 #ifdef DEBUG_DRAW if (debugDraw) |