Skip to content

@relu-interactives/spatial-ecs


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

Class: XRControllerVisualSystem ​

Defined in: systems/XRControllerVisualSystem.ts:97

Implements ​

Constructors ​

Constructor ​

ts
new XRControllerVisualSystem(options?): XRControllerVisualSystem;

Defined in: systems/XRControllerVisualSystem.ts:115

Parameters ​

ParameterTypeDescription
options?{ interactionSystem?: XRInteractionSystem; inputSystem?: XRInputSystem; inputProfilesPath?: string; }-
options.interactionSystem?XRInteractionSystem-
options.inputSystem?XRInputSystem-
options.inputProfilesPath?stringAddress of the game's copy of dist/assets/xr-input-profiles (no trailing slash). With it, Quest controllers and tracked hands load from the game instead of a CDN.

Returns ​

XRControllerVisualSystem

Properties ​

PropertyModifierTypeDefault valueDescriptionDefined in
runsWhilePausedreadonlytruetrueKeep ticking while the world is paused. Leave it unset for anything that moves the game on: such a system stops at world.pause() and picks up where it was at world.resume().systems/XRControllerVisualSystem.ts:98

Methods ​

setInputProfilesPath() ​

ts
setInputProfilesPath(path): void;

Defined in: systems/XRControllerVisualSystem.ts:138

Point hands and controllers at the game's own copy of the bundled input profiles (null goes back to the CDN). Takes effect for sources that connect after the call.

Parameters ​

ParameterType
pathstring | null

Returns ​

void


preloadControllerModels() ​

ts
preloadControllerModels(options?): Promise<number>;

Defined in: systems/XRControllerVisualSystem.ts:164

Load the controller models a headset will ask for, before the session.

three fetches a controller's model from the WebXR input-profiles CDN the moment the controller connects, so on a Quest the GLB arrived seconds into play and its parse, texture upload and shader compile were a 60-230 ms hitch (left.glb in Counters Ball's headset profiles). Loading it here fills three's own cache, so the connect just clones it; passing the world also sends its textures to the GPU and compiles its shaders now.

profiles defaults to what this browser's headset uses (Quest 3/3S, Quest Pro, Quest 2); nothing is loaded anywhere else. Never throws: a failed preload only means the model loads the old way.

Parameters ​

ParameterType
options?{ world?: World; profiles?: string[]; }
options.world?World
options.profiles?string[]

Returns ​

Promise<number>


update() ​

ts
update(world): void;

Defined in: systems/XRControllerVisualSystem.ts:211

Parameters ​

ParameterType
worldWorld

Returns ​

void

Implementation of ​

EcsSystem.update


dispose() ​

ts
dispose(): void;

Defined in: systems/XRControllerVisualSystem.ts:482

Returns ​

void

Implementation of ​

EcsSystem.dispose