You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have found a bug where all Raycasts fail to detect intersections against the correct y position of sleeping or static bodies when the world has gravity, and their y positions are not grounded. (for example a floating static cube at y=5 in a world with -9.8 gravity will never be raycasted unless you cast only on the y axis.)
The text was updated successfully, but these errors were encountered:
johnnyrainbow
changed the title
RaycastAll fails to detect sleeping body
RaycastAll fails to detect sleeping and static bodies
Jan 9, 2024
johnnyrainbow
changed the title
RaycastAll fails to detect sleeping and static bodies
BUG: RaycastAll fails to detect sleeping and static bodies
Jan 9, 2024
johnnyrainbow
changed the title
BUG: RaycastAll fails to detect sleeping and static bodies
BUG: RaycastAll fails to detect sleeping and static bodies at expected y position
Jan 9, 2024
Note for anyone following this or who has the same issue - I added my own temporary fix. The issue stems from the body aabb not updating due to it being either static or sleeping obviously (aabbNeedsUpdate is false), so the aabb is wrong when the raycaster interacts. I fixed it by adding another aabb (ghostabb) to Body class that does update for the sleeping/static body.
This way we can do the raycast against Body.ghostabb, and leave the real aabb as normal
Note for anyone following this or who has the same issue - I added my own temporary fix. The issue stems from the body aabb not updating due to it being either static or sleeping obviously (aabbNeedsUpdate is false), so the aabb is wrong when the raycaster interacts. I fixed it by adding another aabb (ghostabb) to Body class that does update for the sleeping/static body.
This way we can do the raycast against Body.ghostabb, and leave the real aabb as normal
I have found a bug where all Raycasts fail to detect intersections against the correct y position of sleeping or static bodies when the world has gravity, and their y positions are not grounded. (for example a floating static cube at y=5 in a world with -9.8 gravity will never be raycasted unless you cast only on the y axis.)
I made a code sandbox demonstrating the issue. https://codesandbox.io/p/sandbox/cannon-raycast-forked-x6yft5
(You can see in the console that it shows raycast results for only the non sleeping stacked cubes.)
The text was updated successfully, but these errors were encountered: