Skip to content

@relu-interactives/spatial-ecs


@relu-interactives/spatial-ecs / index / XRInputSystem

Class: XRInputSystem ​

Defined in: systems/XRInputSystem.ts:161

Implements ​

Constructors ​

Constructor ​

ts
new XRInputSystem(): XRInputSystem;

Returns ​

XRInputSystem

Methods ​

attachSession() ​

ts
attachSession(session): void;

Defined in: systems/XRInputSystem.ts:199

Bind to a session. Called by XRSessionSystem on session start.

Parameters ​

ParameterType
sessionXRSession

Returns ​

void


detachSession() ​

ts
detachSession(): void;

Defined in: systems/XRInputSystem.ts:212

Unbind and drop all per-source state.

Returns ​

void


update() ​

ts
update(world): void;

Defined in: systems/XRInputSystem.ts:236

Parameters ​

ParameterType
worldWorld

Returns ​

void

Implementation of ​

EcsSystem.update


getInputs() ​

ts
getInputs(): XrInputState[];

Defined in: systems/XRInputSystem.ts:384

Every input source active this frame.

Returns ​

XrInputState[]


getInput() ​

ts
getInput(handedness): XrInputState | null;

Defined in: systems/XRInputSystem.ts:389

The first source for a hand, or null. Prefer this for hand-specific logic.

Parameters ​

ParameterType
handednessXrHandedness

Returns ​

XrInputState | null


getHandInput() ​

ts
getHandInput(handedness): XrInputState | null;

Defined in: systems/XRInputSystem.ts:407

The ARTICULATED source for a hand — the one carrying joint poses.

Distinct from getInput because a hand can be backed by several sources at once: a Quest reports a controller AND a tracked hand for the same handedness, and Vision Pro adds a transient pinch alongside its two persistent hands. getInput returns whichever was seen first, so anything needing JOINTS has to ask for them specifically — taking the first match silently handed pose detection a controller with no joints, and no pose ever fired.

Parameters ​

ParameterType
handednessXrHandedness

Returns ​

XrInputState | null


isSelecting() ​

ts
isSelecting(): boolean;

Defined in: systems/XRInputSystem.ts:417

True while ANY source is selecting — the portable "is the user acting" check.

Returns ​

boolean


dispose() ​

ts
dispose(): void;

Defined in: systems/XRInputSystem.ts:424

Returns ​

void

Implementation of ​

EcsSystem.dispose