I tried the backface filtering during triangle raycasts using
Code: Select all
btCollisionWorld::ClosestRayResultCallback resultCB (...);
resultCB.m_flags = btTriangleRaycastCallback::kF_FilterBackfaces;
So I changed the method btTriangleRaycastCallback::processTriangle in btRaycastCallback.cpp (latest svn) from
Code: Select all
//@BP Mod - Backface filtering
if (((m_flags & kF_FilterBackfaces) != 0) && (dist_a > btScalar(0.0)))
{
// Backface, skip check
return;
}
Code: Select all
//@BP Mod - Backface filtering
if (((m_flags & kF_FilterBackfaces) != 0) && (dist_b > dist_a))
{
// Backface, skip check
return;
}
I found this solution in this thread http://bulletphysics.org/Bullet/phpBB3/ ... 216#p11216
and also verified this on paper as (distB-distA) equals triangleNormal.dot(m_to-m_from).
Or am I completely misled?