# Distal interaction
To interact with distant (distal) objects, the user can use the XR Ray Interactor component from XRIT.
To use the distal interaction feature, the user must bring their hand into the headset's field of view and will see a ray that allows them to aim at the object they want to interact with. The reticle at the end of the ray allows the user to target and refine the precision of the interaction. The pinch gesture activates the selection to manipulate the targeted object.
First, ensure the Hand Tracking inital setup is complete for the scene.
The XRControllerPointerLeft and XRControllerPointerRight prefabs, located in the Packages > QCHT Unity Interactions > Prefabs > Interactions > Distal folder, should be childed to the Camera Offset GameObject in the XR Origin GameObject.
Adjust the raycast parameters by changing the XR Ray Interactor component for each hand. Refer to Unity's documentation to learn more about XR Interactor (opens new window).
By default, the XRController (opens new window) script that controls each hand has the positions set by the
pointerPosition and the rotations set by the
pointerRotation. These are calculated by the XRHandTrackingManager. The Select and UI Press actions are set by default with
triggerPressed (which is the Pinch gesture).
As shown in this exemple, second and third actions can be mapped to another device as a fallback to the hand tracking. Thanks to the new input system compatibility, it's possible to easily support different inputs modalities with the exact same code.
# Snap Volume
Use the XR Interactable Snap Volume (opens new window) component from XRIT for increased raycast accuracy and efficiency.