Skip to main content
Version: 1.0

Basic Scene Setup

AR SESSION AND AR SESSION ORIGIN

If required, Hand Tracking also supports AR Foundation 4.X's AR Session and AR Session Origin as described here.

PRE-DEFINED XR RIG

It is recommend to use pre-defined XR Rig prefab which can be found in QCHTi Samples Core Assets. This asset provides a full XR Rig setup including set up interactors. The rig can be customized by creating a nested prefab variant or unpacking the original prefab.

XR Origin

First, create an XR Origin in the scene as explained here.

After creating an XR Origin GameObject, unfold its hierarchy to view the Left Controller and Right Controller.

XROrigin architecture

Each of the two GameObjects include an XR Controller component which is not mapped to any input actions by default. These two components may be deleted at this point, as predefined ones will be used in the next section.

Then, add an XR Hand Tracking Manager component on the XR Origin (or the AR Session Origin) GameObject.

XR Hand Tracking Manager

XR Hand Tracking Manager

The XR Hand Tracking Manager component is required to visualize the hand models. It listens to XR Hand Tracking Subsystem events at runtime and sets user's tracked hand position relative to the XR Origin. At runtime the Hand Tracking Manager will instantiate left and right hand prefabs and gracefully fade them in and out based on the tracking status of the user's hands.

Add a Hand Tracking Manager to the scene by right-clicking in the scene's Hierarchy and selecting QCHT > Hand Tracking Manager.

QCHT Manager
tip

It is possible to create an instance of an XR Hand Tracking Manager through code by using the InstantiateHandTrackingManager static public API on the XRHandTrackingManager class. This will instantiate an XR Hand Tracking Manager on the XR Origin GameObject and populate hand prefabs with default ones. See the XR Hand Tracking Manager API.

In Editor Simulation

To enable the Hand Tracking simulator, check the simulation subsystem in the XR Plug-in Management > Hand Tracking Simulation section of Unity's Project Settings.

It will also import and enable the XR Interaction Toolkit Device Simulator as the Hand Tracking simulator is built on top of it.

Hand Tracking simulation settings

Ensure, the Use XR Device Simulator in scenes is enabled in the XR Interaction Toolkit section of the Project Settings.

XRIT simulation settings

To learn how to use the simulator, refer to the XR Interaction Toolkit Device Simulator documentation.

tip

When playing the scene in editor, you can quickly switch from head to left/right hand by pressing the tab key of your keyboard.

XRIT simulator in play mode