- Home /
How to get raycast only detect first object from the same masked layer..
I have a Door.. Which can be opened from both sides. I have two colliders on both sides to trigger the action based on which side the player is on.Both triggers are on same layer, I want to keep it same for the sake of simplicity. A racast is hitting them only (That layer only).. i.e layer mask. Now the problem is that sometimes I am on the right side of door but the raycast triggers the event of being on Left side of door & vice versa.. How can i tell raycast to only trigger the event of the trigger that is closest to it or with which it has hit first.. here is pic of my situation... Thanks in advance.
Your answer
Follow this Question
Related Questions
Make a event trigger raycast ignore a layer 1 Answer
How to find connected mesh triangles? 2 Answers
Enemy and gun damge script not working. 2 Answers
Checking for box collider 2 Answers
How to shoot with a raycast? 2 Answers