- Home /
making ray ignor certain collider
hi, i'm working on side-scroll game and i made a plane, and i made a ray going from the cursor so the Character will look at that hit point, but i don't want the ray to collid with anyOther game object, i want it to collid with the plane collider only, thnx.
Answer by Kourosh · Sep 22, 2011 at 07:30 AM
Use layermask to ignore unwanted colliders. Simply define a Layermask variable and pass it to the Raycast function. Then only you will have control over your raycast.
http://unity3d.com/support/documentation/ScriptReference/Physics.Raycast.html
O$$anonymous$$G, i don't know how to thank you !!! i couldn't sleep because of this problem thanks alot :-)
Your answer
Follow this Question
Related Questions
Unreliability of Physics.Raycast.Distance for player movement? 0 Answers
detect Ray Crossing? Intersecting? 1 Answer
How would I find the closest Vector3 point to a given Ray? 2 Answers
Raycast goes through 1 Answer
Raycast for 2d with touch. 0 Answers