I perform a raycast from {0,-9.5,0} to {0,-10,0} and have a static collision box(one of its sides on the y-plane) located at {0,-10,0}. The raycast returns 0 hits in the callback. The next frame passes and another raycast is called from {0,-10,0} to {0,-10.5,0}. Again the raycast returns 0 hits in the callback. If I perform the I perform a raycast from {0,-9.6,0} to {0,-10.1,0}, then the raycast returns a valid hit.
I found where the code was rejecting the first raycast's valid hit result.
File: BtCollisonWorld.cpp
Function: btCollisionWorld::rayTestSingle()
Line: 280.
Code: Select all
if (castResult.m_fraction < resultCallback.m_closestHitFraction)
When I changed the code to
Code: Select all
if (castResult.m_fraction <= resultCallback.m_closestHitFraction)
It works without any apparent problems.
I wanted to make sure that I'm not doing anything “dodgy” or have overlooked another solution. I was under the impression that a raycast is inclusive with its end points. Or are the endpoints exclusive?
Thanks,
BB
P.S.
If this has already been addressed in another thread I apologize for the duplicate post.