Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / components / XRRigComponent

Class: XRRigComponent ​

Defined in: components/XRRig.ts:94

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:141

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:96
locomotionXrLocomotionModeMovement style.components/XRRig.ts:98
moveSpeednumberMetres/second for smooth locomotion.components/XRRig.ts:100
snapTurnbooleanRotate in fixed steps rather than continuously.components/XRRig.ts:102
snapTurnDegreesnumberDegrees per snap-turn step.components/XRRig.ts:104
fallbackEyeHeightnumberEye height fallback for devices without a floor-relative reference space.components/XRRig.ts:106
teleportArcColorstringTeleport arc colour when it lands somewhere valid.components/XRRig.ts:108
teleportArcInvalidColorstringTeleport arc colour when it lands nowhere teleportable.components/XRRig.ts:110
teleportArcThicknessnumberTeleport arc thickness (diameter), metres.components/XRRig.ts:112
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. The session's blend mode is fixed, but a passthrough session can still show a fully virtual world: world.setXrView("virtual") covers the room with the scene's sky, live. A session started without passthrough can never show the room.components/XRRig.ts:123
depthOcclusionbooleanLet real objects occlude virtual ones, via WebXR depth sensing.components/XRRig.ts:125
environmentPhysicsXrEnvironmentPhysicsWhich detected real-world geometry becomes physics colliders.components/XRRig.ts:127
environmentDebugbooleanDraw the detected room geometry on-device, for checking a scan.components/XRRig.ts:129
hitTestbooleanAllow scripts to raycast against the real room (hit-test).components/XRRig.ts:131
anchorsbooleanAllow content to be pinned to real-world features (anchors).components/XRRig.ts:133
startView?XrViewWith passthrough: whether a session starts showing the room or a fully virtual world (scripts switch with world.setXrView). Absent until authored, which means room.components/XRRig.ts:139