- Home /
Problem Using LayerMask - Collisions
Hello,
I'm having a bit of trouble using LayerMasking for my Physics.Raycast.
I basically want my raycast to only ignore layers 8 and 14, how would I do that?
var layerMask = 8 << 14;
layerMask = ~layerMask;
Thanks
Answer by Dreamer · Jun 07, 2011 at 01:54 AM
2 ways:
var layerMask = ~((1<<8)|(1<<14))
(Remember to assign the script to object again , so the value will be updateds)
Declare as var layerMask:LayerMask; and you can specify it in Inspector.
You can refer to the question I asked before if you want to know more about LayerMask, lol
http://answers.unity3d.com/questions/126285/how-to-create-a-user-layer-that-ignore-raycast.html
Your answer
Follow this Question
Related Questions
Detecting that I'm clicking a unit even though I'm not? 0 Answers
Four different Raycast functions? 1 Answer
Raycast layer mask problem 1 Answer
My raycast ignores layer mask, could you give me some advice? 1 Answer
How do I use layermasks? 9 Answers