@relu-interactives/spatial-ecs
@relu-interactives/spatial-ecs / components / XRRigComponent
Class: XRRigComponent ​
Defined in: components/XRRig.ts:85
Marks an entity as the XR rig — the player's movable origin.
The rig exists because a WebXR headset owns the camera pose absolutely: three composes the render camera as rig.matrixWorld × headPose, so the ONLY way to move the player is to move the camera's parent. The camera entity must be a child of this entity.
Defaults are deliberately comfort-first — teleport locomotion with snap turning is the combination least likely to cause motion sickness, and is what every platform's design guidance recommends as the baseline.
Extends ​
Constructors ​
Constructor ​
ts
new XRRigComponent(options?): XRRigComponent;Defined in: components/XRRig.ts:125
Parameters ​
| Parameter | Type |
|---|---|
options? | XRRigOptions |
Returns ​
XRRigComponent
Overrides ​
Properties ​
| Property | Type | Description | Defined in |
|---|---|---|---|
trackingOrigin | XrTrackingOrigin | Where the headset origin sits (floor-relative vs eye-relative). | components/XRRig.ts:87 |
locomotion | XrLocomotionMode | Movement style. | components/XRRig.ts:89 |
moveSpeed | number | Metres/second for smooth locomotion. | components/XRRig.ts:91 |
snapTurn | boolean | Rotate in fixed steps rather than continuously. | components/XRRig.ts:93 |
snapTurnDegrees | number | Degrees per snap-turn step. | components/XRRig.ts:95 |
fallbackEyeHeight | number | Eye height fallback for devices without a floor-relative reference space. | components/XRRig.ts:97 |
teleportArcColor | string | Teleport arc colour when it lands somewhere valid. | components/XRRig.ts:99 |
teleportArcInvalidColor | string | Teleport arc colour when it lands nowhere teleportable. | components/XRRig.ts:101 |
teleportArcThickness | number | Teleport arc thickness (diameter), metres. | components/XRRig.ts:103 |
passthrough | boolean | Run the session in passthrough — the real room shows through. This is the VR/MR switch for the whole project: the entry button requests immersive-ar instead of immersive-vr. Blend mode is fixed for the life of a session, so this cannot be flipped mid-session — ending and re-entering is the only way to change it. | components/XRRig.ts:113 |
depthOcclusion | boolean | Let real objects occlude virtual ones, via WebXR depth sensing. | components/XRRig.ts:115 |
environmentPhysics | XrEnvironmentPhysics | Which detected real-world geometry becomes physics colliders. | components/XRRig.ts:117 |
environmentDebug | boolean | Draw the detected room geometry on-device, for checking a scan. | components/XRRig.ts:119 |
hitTest | boolean | Allow scripts to raycast against the real room (hit-test). | components/XRRig.ts:121 |
anchors | boolean | Allow content to be pinned to real-world features (anchors). | components/XRRig.ts:123 |

