Limit the Raycast interaction distance in the current VR Gaze Input Module?

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);
         
     }
}

I made a custom script ‘InteractiveObject’ and made GazeInputModule’s Process() funciton look at a distance var set on InteractiveObject script before it allows objects to be selected with inputsystem. Take a look at the process function to see how it’s working:

1 Like

Thank you. I assume I have to replace the Process function in your old GazeInputModule with your new Process function, or add a second script with your the new Process function?
The custom script ‘InteractiveObject’ is an empty script with a distance variable, that I attach to all objects to be interacted with, is that correct?
EDIT: For future readers that are as nooby as me: The Process function above replaces the one in the GazeInputModule module, all works well.