Yes, but try implementing it… doesn’t work… get a Unity error instead.
this :-
if (Physics.Raycast (ray.origin, ray.direction, hit, lMask)) {
produces this :-
Assets/Scripts/Camera/ObjectSelector.js(294,29): BCE0023: No appropriate version of 'UnityEngine.Physics.Raycast' for the argument list '(UnityEngine.Vector3, UnityEngine.Vector3, UnityEngine.RaycastHit, UnityEngine.LayerMask)' was found.
Look at the docs a bit more closely: “layerMask : int = kDefaultRaycastLayers”. It takes an integer, so you use LayerMask.value. Or just an int, if you understand layermasks.