- Home /
 
              This question was 
             closed Jun 19, 2014 at 03:24 PM by 
             meat5000 for the following reason: 
             
 
            The question is answered, right answer was accepted
 
               Question by 
               smirlianos · Jun 19, 2014 at 12:24 PM · 
                raycasttagraycasthitrayhit  
              
 
              Exclude tag from raycast
Hello,
is it possible to exclude a tag from the "search" of a raycast?
               Comment
              
 
               
               
               Best Answer 
              
 
              Answer by Lyje · Jun 19, 2014 at 12:29 PM
You need to use layers rather than tags. Physics.Raycast() has a LayerMask argument which allows you to check against or exclude any layers. To use it, declare public LayerMask mask; in your gameobject, set the layers you want to check against in the editor, then do for example Physics.Raycast(origin, direction, distance, mask.value);.
Follow this Question
Related Questions
Raycast isn't working on small distances 1 Answer
Need Help with RayCast. No Vector? 1 Answer
How to get information from raycast? 2 Answers