Skip to content

@relu-interactives/spatial-ecs


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

Class: XRSessionSystem ​

Defined in: systems/XRSessionSystem.ts:27

Owns the immersive-session lifecycle and fans XR events out to Behaviours.

Detects session start/end by polling renderer.xr.isPresenting rather than binding to sessionstart/sessionend: the session may already be running before this system is registered (the consumer owns the entry button), and polling a boolean makes the system correct regardless of construction order.

Hook dispatch mirrors ImageTargetAnchorSystem's AR precedent — walk live ScriptComponent.scriptInstances and call the public no-op hook — so XR and AR extend Behaviour the same way.

Implements ​

Constructors ​

Constructor ​

ts
new XRSessionSystem(inputSystem?): XRSessionSystem;

Defined in: systems/XRSessionSystem.ts:36

Parameters ​

ParameterType
inputSystem?XRInputSystem

Returns ​

XRSessionSystem

Methods ​

update() ​

ts
update(world): void;

Defined in: systems/XRSessionSystem.ts:40

Parameters ​

ParameterType
worldWorld

Returns ​

void

Implementation of ​

EcsSystem.update


getCapabilities() ​

ts
getCapabilities(): XrCapabilities;

Defined in: systems/XRSessionSystem.ts:242

What the active session granted. NO_XR_CAPABILITIES when not presenting.

Returns ​

XrCapabilities


isPresenting() ​

ts
isPresenting(): boolean;

Defined in: systems/XRSessionSystem.ts:247

True while an immersive session is presenting.

Returns ​

boolean


getInputs() ​

ts
getInputs(): XrInputState[];

Defined in: systems/XRSessionSystem.ts:252

Convenience passthrough so consumers need only hold this system.

Returns ​

XrInputState[]