Raycast obstacle avoidence with sphere collider issue

I’ve been looking around at ways to do obstacle avoidance and found using raycasts on sphere colliders to get the normal point and adjust the moving direction but I found a scenario that stops it working.

This is what generally happens

But this happens when the sphere colliers are aligned (this case was the same Y positions ) and the hit point normal returned just comes straight backwards.

Was wondering what the best approach would be to solve this?

Easiest solution would be to just add a random 0.00001f to each axis during avoidance calculation.

Alternatively, check if the normal is within a small tolerance of the reciprocal of the movement vector.

1 Like

awesome thank you :slight_smile: