Issue with NonAllocCast returning 0,0,0 point collisions

There are instances when the detectHorizontalCollisions checks for collisions and when inside that function it calls TPC's NonAllocCast function and returns the raycast hit point as 0,0,0 because the colliders are overlapped. This is causing a lot of problems with the physics because it uses this point to raycast and determine if the character is grounded, but since the point is not set it doesn't identify any ground and basically just stops the character where it is. I am not sure why this is happening, it only seems to happen when the character is going faster speeds on ramps, but i don't see anything in the code to protect from this. Should this ever happen or have you seen this happen?
 
No it is a box collider, I believe it is working as intended, as the Unity documentation states:

Notes: 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. You might want to check whether this is the case in your particular query and perform additional queries to refine the result.

so anytime it is overlapping it will be zero. Have you ever had any problems with this in your engine? I know that for my project it is relatively high speeds for some scenarios and others might not experience it.

*** that was taken from https://docs.unity3d.com/ScriptReference/Physics.BoxCastAll.html
 
If a collider is overlapping it will return zero, but it should never get to that state in the first place. If you can list the steps to reproduce from a fresh project that would be great.
 
Top