Right now I’m using this to ignore the 9th layer, but how do I tell it to ignore both the 9th and 10th layers?
var LayerMask = 1 << 9;
LayerMask = ~LayerMask;
var hit : RaycastHit;
if (Physics.Raycast(transform.position, ShotDirection, hit, Range, LayerMask)) {
//SOMETHING!!!
}
One easy way is to use the LayerMask type:
var layerMask : LayerMask; //UnityScript
LayerMask layerMask; //C#
Now you can go to the inspector and set the layers you want. If you want to do it in code:
var layerMask = 1 << 9 | 1 << 10;
layerMask = ~layerMask;
This doesn’t seem to work with C#???