Raycast not working for overlaying objects?

Hello everyone!

I am trying to implement a camera Raycaster into my own project but I am having some issues.
The Physics.Raycast does not seem to stop when it hit a collider. So if I have some objects that are behind each other or ‘overlaying’ from the view I am shooting my ray at, it will always return every layer as hit since it does not stop after first hit.

Any ideas on how to make my ray ‘stop’ and return after a first hit?

Perhaps post your code so we can have a look?


See also;

Privacy & Terms