Physics.BoxCastAll incorrect results
So I have done extensive testing on Physics.BoxCastAll()
with some interesting results.
Here is the case with I am most curious about:
player info:
extents: (0.3, 0.8, 0.3)
position: (0, 0, 4.649899)
cube I'm testing info:
extents (0.5, 0.5, 0.05)
position (0, 0, 5)
So, the player can get as close as 4.65 (or 4.64999 with floating point issues) without triggering the collision found by Physics.OverlapBox()
.
However, as noted in Physics.BoxCastAll()
: For colliders that overlap the box at the start of the sweep, RaycastHit.normal is set opposite to the direction of the sweep, RaycastHit.distance is set to zero, and the zero vector gets returned in RaycastHit.point.
Well, Physics.OverlapBox()
doesn't think I am inside of anything, but the Physics.BoxCastAll()
returns the zero vector for position, so it thinks I am inside of something.
I am interested in what the solution for this problem is. The Unity docs don't really give you another option.
Your answer
![](https://koobas.hobune.stream/wayback/20220613023747im_/https://answers.unity.com/themes/thub/images/avi.jpg)