XRShared Rig Setup
This page describes how to set up the rigs of the XRShared addon in a scene: the default prefabs, the spawning of the network rig, and the components adapting a rig built with another SDK. For the role of the hardware rig and the network rig, see Rig Architecture.
Default rig prefabs
A user relies on two distinct rigs, with distinct roles:
- the hardware rig, placed in the scene, is not networked: it follows the local devices (headset, controllers, hands), and handles the local interactions (grabbing detection, locomotion, ...). There is only one, for the local user.
- the network rig is a networked prefab, spawned for each user: it copies the hardware rig of its user, synchronizes it, and displays the user to everyone.
Both are needed: a hardware rig in the scene, and a network rig prefab whose rig parts match it (a headset, controllers and hands for the hardware ones).
The rig of another SDK (Meta building blocks, XR Interaction Toolkit, ...) can also act as the hardware rig, while the network rig stays the same: see Rig Architecture and Interaction setups for other rigs.
The prefab paths are relative to the XRShared addon Runtime folder, and the sample path to the XRShared addon folder.
Hardware rigs
| Prefab | GUID | Content |
|---|---|---|
DefaultRigPrefabs/HardwareRig.prefab |
d4969c23583fe1340a6ebf1d09e5dd9c |
Hardware rig with controllers and hand tracking (XR Hands). The rig to place in the scene for most projects. |
BaseRig/Prefabs/HardwareRigWithoutHands.prefab |
e53f6e9b3a8ba3040bbf7bf83ceda663 |
Same hardware rig, with controllers only. HardwareRig is a variant of it. |
BaseRig/Prefabs/DesktopSimulation/DesktopRig.prefab |
d14ccad9a6cb98343abc69e41b5db873 |
Hardware rig for desktop users, driven by the keyboard and the mouse (see Desktop rig). |
The default HardwareRig already contains:
- the headset (
HardwareHeadset), with aFaderfor the locomotion fades, - for each controller: the tracking (
XRControllerInputDevice, with the per runtimeXRControllerPoseOffsets), theHardwareControllerrig part and its input (HardwareControllerCommand), aGrabber, a teleportBeamer, and a simulated hand following the controller inputs, with an index tip (IndexTipMarker, used to touch objects and UI) and a wrist marker, - for each hand: an
XRHandsHardwareHand(see XRHands synchronization), with aGrabber(pinch to grab) and a wrist marker, - a
RigPartVisualizeron controllers and hands: the hardware rig parts are displayed while offline, and hidden while online, as the network rig displays them, RigLocomotion, for teleport and snap turn (see Locomotion).
Network rigs
| Prefab | GUID | Content |
|---|---|---|
DefaultRigPrefabs/NetworkRig.prefab |
08032fa3f321eae468af6b7ed7dde9a4 |
Network rig matching HardwareRig: the user prefab to spawn for each user. |
DefaultRigPrefabs/NetworkRig With DummyAvatar Variant.prefab |
84cb061b2bd6b8b488b173f842b0f194 |
NetworkRig with a simple avatar body, hidden for the local user (HideForLocalUser). |
Core/Prefabs/NetworkRigWithoutHands.prefab |
4929e0c1b3e25bd4195cc6ddd4724fe5 |
Network rig matching HardwareRigWithoutHands. NetworkRig is a variant of it. |
The default NetworkRig contains the network counterpart of each hardware rig part, which finds and follows it for the local user:
- the headset (
NetworkHeadset), - for each controller: a
NetworkController, with aNetworkControllerCommandsynchronizing the controller buttons, so that the simulated hand displayed on the controller animates for every user, and aNetworkGrabber, - for each hand: a
NetworkHand, with aNetworkBonesStateSyncsynchronizing the finger bones (see XRHands synchronization), and aNetworkGrabber.
A NetworkGrabber represents a hand or controller able to grab on the network rig: networked grabbable objects (NetworkGrabbable) reference it as their grabber, and follow it for every user (see Rig Architecture).
Sample
The "Default rig setup" sample (Samples/DefaultRig/Scenes/DemoDefaultRig.unity) shows it with grabbable and touchable objects.
Spawning the network rig
Each user has their own network rig, spawned when they join the session:
- place the hardware rig (for instance the
HardwareRigprefab) in the scene, - add a Fusion
FusionBootstrapto start the session, with Start Mode set toAutomaticand Auto Start As set toShared(its defaultUserInterfacestart mode shows a menu that can't be used in a headset). Add aNetworkRunnergame object with aUserSpawner, with the network rig prefab (for instanceNetworkRig) asuserPrefab, and set this game object as theFusionBootstrapRunner Prefab. Each user spawns their own network rig: check the "Destroy When State Authority Leaves" option of itsNetworkObject, so that it is removed when the user leaves. - once spawned, the local user network rig finds the hardware rig (registered in the
HardwareRigsRegistry), and follows it.
The Connection Manager addon can replace FusionBootstrap and UserSpawner when its advanced options are needed (room selection, ...): the XRShared samples use it.
To let the user choose between several hardware rigs (VR, desktop, ...) before connecting, see the Extended Rig Selection addon.
Building a hardware rig from an XR Origin
HardwareRigAutomaticSetup adds the XRShared components to an existing rig, or builds one from an empty game object. Placed on the rig root, its inspector offers:
- an "Automatic rig setup" button, applying all the steps enabled in
setupConfig, - one button per step, to apply them one by one.
The steps, each one skipped when its components already exist:
- rig creation:
XROrigin, camera offset and camera (with aTrackedPoseDriver), controllers (XRControllerInputDeviceandXRControllerPoseOffsets), simulated hands on the controllers, XR Hands hand tracking models, - hardware rig parts:
HardwareRig,HardwareHeadset,HardwareController,XRHandsHardwareHand, with aRigPartVisualizerhiding the controllers and hands while online, - interactions, off by default:
GrabbingSetup(addGrabbing), andRigLocomotionwith a beamer on each controller and aFaderon the camera (addLocomotion).
Each change is logged in the console (logEdits). The XR Hands steps require the XR Hands package.
Interaction setups for other rigs
Some rigs are not built with XRShared: Meta building block rigs (see the Meta Core integration addon), XR Interaction Toolkit rigs, ... Once their rig parts implement the XRShared interfaces, the following components add the XRShared interactions at runtime. They are placed next to the hardware rig component, and also handle the rig parts created after the start (hands created when hand tracking starts, ...).
| Component | Adds to each rig part |
|---|---|
GrabbingSetup |
A Grabber on controllers and hands, with a kinematic rigidbody and a trigger collider when none exists. For hands, it is placed on the index tip if available (useIndexFollowerWhenAvailableForGrabbing). grabbingColliderLayer sets the collider layer. |
TouchingSetup |
A Toucher on the index tip of controllers and hands (index tip follower, or IndexTipMarker), with a kinematic rigidbody and a trigger collider when none exists. |
FingerBeamerSetup |
A teleport beam controlled by hand tracking on each hand (see Locomotion). |
SimulatedHandsSetup |
A simulated hand on each controller, with an index tip and a wrist marker: controllers can then touch objects, and wear the Watch Menu. |
When a collider is created automatically, a warning suggests to create one in the scene instead, for a better position (removeColliderAutosetupWarning hides it).
On Android, an animated hand whose renderers are disabled is not animated, so its index tip would not follow the fingers.
That is why the hidden hardware simulated hands use a transparent material (TransparentMaterialForHardwareHands) instead of disabled renderers while online.
Controllers on several runtimes
Controller pose offsets
Each device places the controller poses differently relatively to the hand, while the simulated hands are tuned for the Meta Quest aim pose.
XRControllerPoseOffsets, next to an XRControllerInputDevice, corrects the controller pose per device:
- each entry applies when the app runs on the device of its
devicecriteria, matched on the device model, whatever the controller (see Settings for some devices only; the first matching entry is used), - it selects the pose followed (
Aim,Grip, orDefault: the detection mode of theXRControllerInputDevice), and adds a position and rotation offset, - values are given for the left controller, and mirrored for the right one.
The default controllers include a PICO entry, tuned on PICO 4 Ultra.
To tune another device, XRControllerPoseLogger logs the device model to match, and the offset between the controller aim and grip poses. The offsets themselves are tuned visually, against the real hand (in passthrough).
Controllers put down during hand tracking
Some runtimes (PICO) keep reporting a controller put down as tracked while the user switched to hand tracking: the controller and what follows it (simulated hand, watch, ...) stay where the controller lies.
With notTrackedWhileSameSideHandTracked, a HardwareController is considered not tracked while the hand of the same side is tracked.
The option is off by default, as other runtimes track controllers and hands at the same time on purpose (Meta Quest multimodal).
To enable it only for the affected runtimes, place a HandTrackingOverridesControllers on an object active only for them, for instance in the game objects of an Extended Rig Selection rig kind: while it is enabled, it turns the option on for the controllers of its hardwareRig (all the scene controllers if not set), and restores their previous value when it is disabled.
Desktop rig
The DesktopRig prefab is a hardware rig for desktop users, mostly for prototyping and tests:
DesktopController: W, A, S, D keys to move, Q and E to turn. The move follows the height of the locomotion surfaces of theRigLocomotion,MouseCamera: moving the mouse while the right button is pressed turns the head,MouseTeleport: a left click teleports to the aimed point, or grabs the aimed grabbable object.
For desktop moves restricted like the VR ones, see the Locomotion Validation addon.
Last updated on
Back to top