Skip to content

@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 ​

ParameterType
options?XRRigOptions

Returns ​

XRRigComponent

Overrides ​

Component.constructor

Properties ​

PropertyTypeDescriptionDefined in
trackingOriginXrTrackingOriginWhere the headset origin sits (floor-relative vs eye-relative).components/XRRig.ts:87
locomotionXrLocomotionModeMovement style.components/XRRig.ts:89
moveSpeednumberMetres/second for smooth locomotion.components/XRRig.ts:91
snapTurnbooleanRotate in fixed steps rather than continuously.components/XRRig.ts:93
snapTurnDegreesnumberDegrees per snap-turn step.components/XRRig.ts:95
fallbackEyeHeightnumberEye height fallback for devices without a floor-relative reference space.components/XRRig.ts:97
teleportArcColorstringTeleport arc colour when it lands somewhere valid.components/XRRig.ts:99
teleportArcInvalidColorstringTeleport arc colour when it lands nowhere teleportable.components/XRRig.ts:101
teleportArcThicknessnumberTeleport arc thickness (diameter), metres.components/XRRig.ts:103
passthroughbooleanRun 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
depthOcclusionbooleanLet real objects occlude virtual ones, via WebXR depth sensing.components/XRRig.ts:115
environmentPhysicsXrEnvironmentPhysicsWhich detected real-world geometry becomes physics colliders.components/XRRig.ts:117
environmentDebugbooleanDraw the detected room geometry on-device, for checking a scan.components/XRRig.ts:119
hitTestbooleanAllow scripts to raycast against the real room (hit-test).components/XRRig.ts:121
anchorsbooleanAllow content to be pinned to real-world features (anchors).components/XRRig.ts:123