[Solved] Raycast hits objects outside of LayerMask

Hello! I have an issue with raycasts hitting objects outside of the specified LayerMask.
I would much appreciate any help, thanks!

Double check what overload for Physics.RayCast you’re using as per your IDE: Unity - Scripting API: Physics.Raycast

Often times folks think they’re passing a layer mask, but they’re passing the max distance. Best to use named-arguments with this method in particular.

1 Like

I already know that’s it, thank you for the help!