Searching the forums did not yield an answer, unless I overlooked something.
Limiting the distance in which the raycasts react to object would be very useful, in that it it allows the player to interact with close objects, but not unintentionally trigger clicks on objects far away.
I am familiar with Unity - Scripting API: Physics.Raycast and the code example below but the VR Gaze Input module does not appear to contain code that defines the distance.
My scene has the current standard setup for cardboard games, including the following:
– The GvrViewerMain
– A player character with a camera attached to it, the latter with the PhyicsRaycaster script attached (uneditable) and a GvrReticle
– An EventSystem
public class Example : MonoBehaviour {
void Update() {
Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
RaycastHit hit;
if (Physics.Raycast(ray, out hit, 2))
Debug.DrawLine(ray.origin, hit.point);
}
}