(Mobile) Raycast still ignores everything instead of objects with specified layers


The problem is that I need to detect which object I hit when touching the screen but nothing gets detected.

I have a plane all the shapes land on. The plane is surrounded by empty game objects with big colliders (kind of borders). The point is that all these objects have the layer I ignore.

This is the code:

newTouch = Input.GetTouch (0);

					Ray ray = Camera.main.ScreenPointToRay(newTouch.position);
					int layerMask =~( (1 << 8) | (1 << 10));
					RaycastHit hit;
					if (Physics.Raycast(ray, out hit, layerMask)) {
						nameOfTheClickedShape = hit.transform.root.gameObject.name;}

The problem that it still ignores the objects with the 9th layer and I have no idea why.

Hope my explanation is clear.



if (Physics.Raycast(ray, out hit, Mathf.Infinity, 1 << 9))