Use the more accurate, but slightly slower, gjk ray test by default, instead of the sub-simplex convex cast.

Set the rayCallback.m_flag  btTriangleRaycastCallback::kF_UseSubSimplexConvexCastRaytest to enable the previous approximate/faster ray test.
This commit is contained in:
erwin.coumans@gmail.com
2013-10-19 16:42:17 +00:00
parent d998680a68
commit 5bd6decb2e
2 changed files with 4 additions and 4 deletions

View File

@@ -294,10 +294,10 @@ void btCollisionWorld::rayTestSingleInternal(const btTransform& rayFromTrans,con
//btContinuousConvexCollision convexCaster(castShape,convexShape,&simplexSolver,0);
bool condition = true;
btConvexCast* convexCasterPtr = 0;
if (resultCallback.m_flags & btTriangleRaycastCallback::kF_UseGjkConvexRaytest)
convexCasterPtr = &gjkConvexCaster;
else
if (resultCallback.m_flags & btTriangleRaycastCallback::kF_UseSubSimplexConvexCastRaytest)
convexCasterPtr = &subSimplexConvexCaster;
else
convexCasterPtr = &gjkConvexCaster;
btConvexCast& convexCaster = *convexCasterPtr;

View File

@@ -35,7 +35,7 @@ public:
kF_None = 0,
kF_FilterBackfaces = 1 << 0,
kF_KeepUnflippedNormal = 1 << 1, // Prevents returned face normal getting flipped when a ray hits a back-facing triangle
kF_UseGjkConvexRaytest = 1 << 2, // Uses a more accurate but slightly slower ray versus convex algorithm
kF_UseSubSimplexConvexCastRaytest = 1 << 2, // Uses an approximate but faster ray versus convex intersection algorithm
kF_Terminator = 0xFFFFFFFF
};
unsigned int m_flags;