Hiyah! Unity is being very stubborn with me, and insisting that I have to use the first method declaration of Physics.Raycast (static function Raycast (origin : Vector3, direction : Vector3, distance : float = Mathf.Infinity, layerMask : int = kDefaultRaycastLayers) : bool), and I’m not sure why. My code:
Ray ray = camera.ScreenPointToRay (new Vector3(mp.x,mp.y,0));
RaycastHit hit = new RaycastHit();
if (Physics.Raycast (ray, hit, 100))
{
Debug.Log(hit.distance);
}