I'm having a problem with filters/masks when raycasting.
I've created a LayerMask and then in the inspector selected the layer I want to ignore when Raycasting. however then I print out the name of the object hit by the raycast I am still getting hits on objects on the layer masked out, as well as on other layers.
public LayerMask rayMask;
RaycastHit hit;
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
if (Physics.Raycast (ray, out hit,rayMask)){
Debug.Log (hit.collider.name);
}
I have paused the Game and checked that the object I'm getting a hit on is indeed on the layer in the mask.
[solved]
post an answer instead. \$\endgroup\$ – Soapy Apr 1 '15 at 10:21