diff options
author | Erwin Coumans <blender@erwincoumans.com> | 2006-04-24 08:58:37 +0400 |
---|---|---|
committer | Erwin Coumans <blender@erwincoumans.com> | 2006-04-24 08:58:37 +0400 |
commit | 8291024b99ab1482b8f2ab257368c246a2f7849b (patch) | |
tree | 2940e5af8a55acd6161dca9341e7d7d95e00dce3 /extern | |
parent | c781a840b22d4142f9e9bb23d4aa2385fbaca64b (diff) |
fixes in raycasting
Diffstat (limited to 'extern')
-rw-r--r-- | extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.cpp | 9 | ||||
-rw-r--r-- | extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp | 5 |
2 files changed, 9 insertions, 5 deletions
diff --git a/extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.cpp b/extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.cpp index a71272552da..019b4c3bfcb 100644 --- a/extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.cpp +++ b/extern/bullet/Bullet/NarrowPhaseCollision/SubSimplexConvexCast.cpp @@ -54,8 +54,11 @@ bool SubsimplexConvexCast::calcTimeOfImpact( //float radius = 0.01f; SimdScalar lambda = 0.f; - SimdVector3 s = rayFromLocalA.getOrigin(); - SimdVector3 r = rayToLocalA.getOrigin()-rayFromLocalA.getOrigin(); + //todo: need to verify this: + //because of minkowski difference, we need the inverse direction + + SimdVector3 s = -rayFromLocalA.getOrigin(); + SimdVector3 r = -(rayToLocalA.getOrigin()-rayFromLocalA.getOrigin()); SimdVector3 x = s; SimdVector3 v; SimdVector3 arbitraryPoint = convex->LocalGetSupportingVertex(r); @@ -120,7 +123,7 @@ bool SubsimplexConvexCast::calcTimeOfImpact( //int numiter = MAX_ITERATIONS - maxIter; // printf("number of iterations: %d", numiter); result.m_fraction = lambda; - result.m_normal = -n; + result.m_normal = n; return true; } diff --git a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp index 4359eeffffe..fd4bca40e7f 100644 --- a/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp +++ b/extern/bullet/Extras/PhysicsInterface/CcdPhysics/CcdPhysicsEnvironment.cpp @@ -508,6 +508,7 @@ bool CcdPhysicsEnvironment::proceedDeltaTime(double curTime,float timeStep) + if (!SimdFuzzyZero(timeStep)) { @@ -1300,9 +1301,9 @@ PHY_IPhysicsController* CcdPhysicsEnvironment::rayTest(PHY_IPhysicsController* i ConvexShape* convexShape = (ConvexShape*) body->GetCollisionShape(); VoronoiSimplexSolver simplexSolver; - //SubsimplexConvexCast convexCaster(&pointShape,convexShape,&simplexSolver); + SubsimplexConvexCast convexCaster(&pointShape,convexShape,&simplexSolver); //GjkConvexCast convexCaster(&pointShape,convexShape,&simplexSolver); - ContinuousConvexCollision convexCaster(&pointShape,convexShape,&simplexSolver,0); + //ContinuousConvexCollision convexCaster(&pointShape,convexShape,&simplexSolver,0); if (convexCaster.calcTimeOfImpact(rayFromTrans,rayToTrans,body->getCenterOfMassTransform(),body->getCenterOfMassTransform(),rayResult)) { |