Hi. Use cannojs as phys engine. After upgrading to bjs 5.18.0 i register false negative results from scene.pickWithRay(). It gets some false results every ~1 second. It breaks movement logic.
const pick = this._scene.pickWithRay(this._playerGroundRay);
if (pick) {
this._onObject = pick.hit; // here pick.hit false negative sometimes
}
Check console.log, you will see “false” at the start when playing. But i cant reproduce exactly worse behaviour like in my project (many infinity false positives). I will try to update pg to catch more but it will takes a time.
This boils down to a precision issue with the numerical values computing by the physics engine. Their steps are so small, it creates some issues in running the triangle-ray intersection algorithm.
I actually extracted some values for the current raycast function to double check it:
@RaananW will be back next week and might have a workaround for it ?
Check the logs and you will see that the ground’s position is not 0,0,0 (but almost :-)) and the fixed rays I have created are returning false after a while.
This is physics-engine related. Something you can do is force a position on impostors that are fixed: