Skip to main content
Version: 1.0

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, users must bring a hand into the headset's field of view. When detected, a ray that allows to aim at interactable objects appears. The reticle at the end of the ray allows users to target and refine the precision of the interaction. The pinch gesture activates the selection to manipulate the targeted object.

Description

First, ensure the Hand Tracking inital setup is complete for the scene.

XR Ray Interactor

Using the predefined XR Rig prefab which can be found in QCHTi Samples Core Assets, the Hand Controller Left and Hand Controller Right prefabs are childed to the Camera Offset GameObject in the XR Origin GameObject.

After importing the QCHTi Samples Core Assets, the Hand Controller Left and Hand Controller Right prefabs can be found in Assets > Samples > QCHT Unity Interactions > [package version number] > QCHT Interactions Samples > Core Assets > Prefabs > Interactions folder.

Adjust the raycast parameters by changing the XR Ray Interactor component for each Hand Controller GameObject. Refer to Unity's documentation to learn more about XR Interactor.

By default, the XRController script that controls each pointer has the positions set by the pointerPosition and the rotations set by the pointerRotation. These are calculated by the XR HandTracking Subsystem or fetched by the Hand Tracking Interaction Profile when activated. The Select and UI Press actions are set by default with triggerPressed or selectPressed (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.

tip

It is highly recommended to use the Core Assets to get a full predefined XR Rig setup with a default input action mapping.

Snap Volume

Use the XR Interactable Snap Volume component from XRIT to increase raycast accuracy and efficiency.