Class: WebXRInputProvider
Defined in: threejs-interactions/src/webxr-provider.ts:76
Implements
InputProvider
Constructors
Constructor
new WebXRInputProvider(context: WebXRProviderContext): WebXRInputProvider;
Defined in: threejs-interactions/src/webxr-provider.ts:102
Parameters
| Parameter | Type |
|---|---|
context | WebXRProviderContext |
Returns
WebXRInputProvider
Methods
dispose()
dispose(): void;
Defined in: threejs-interactions/src/webxr-provider.ts:485
Returns
void
getCapabilities()
getCapabilities(): InputCapabilities;
Defined in: threejs-interactions/src/webxr-provider.ts:251
Current negotiated capabilities (derived from the LIVE session).
Returns
InputCapabilities
Implementation of
InputProvider.getCapabilities
getHeadPose()
getHeadPose(): HeadPose;
Defined in: threejs-interactions/src/webxr-provider.ts:401
Head pose, when capabilities.headPose is true.
Returns
HeadPose
Implementation of
InputProvider.getHeadPose
onCapabilitiesChanged()
onCapabilitiesChanged(listener: (c: InputCapabilities) => void): Unsubscribe;
Defined in: threejs-interactions/src/webxr-provider.ts:255
Capability changes: session start/end, hands⇄controllers swap.
Parameters
| Parameter | Type |
|---|---|
listener | (c: InputCapabilities) => void |
Returns
Unsubscribe
Implementation of
InputProvider.onCapabilitiesChanged
onSourcesChanged()
onSourcesChanged(listener: () => void): Unsubscribe;
Defined in: threejs-interactions/src/webxr-provider.ts:260
Source connect/disconnect.
Parameters
| Parameter | Type |
|---|---|
listener | () => void |
Returns
Unsubscribe
Implementation of
InputProvider.onSourcesChanged
pulse()
pulse(
sourceId: string,
intensity: number,
durationMs: number
): boolean;
Defined in: threejs-interactions/src/webxr-provider.ts:467
Fire a haptic pulse on a source, when capabilities.haptics is true
and the source reports hapticsAvailable. Returns false when the
pulse could not be delivered. Intensity 0..1, duration in ms.
Parameters
| Parameter | Type |
|---|---|
sourceId | string |
intensity | number |
durationMs | number |
Returns
boolean
Implementation of
InputProvider.pulse
registerVisual()
registerVisual(handedness: "left" | "right", root: Object3D): void;
Defined in: threejs-interactions/src/webxr-provider.ts:423
Hand the provider the scene object that represents one side's hand or controller, so presence can hide and show it. Nothing here builds those models: a standalone three.js app owns its own, and this is the hook that lets it be driven from the same place as an IWSDK app's.
Registering the same side twice replaces the previous root. The first
registration turns capabilities.presence on and notifies every
capabilities listener, so an app can gate its presence UI on the
capability like it does on every other one.
Parameters
| Parameter | Type |
|---|---|
handedness | "left" | "right" |
root | Object3D |
Returns
void
sample()
sample(): readonly InputSourceSnapshot[];
Defined in: threejs-interactions/src/webxr-provider.ts:265
Snapshot every live source. Called once per update tick.
The snapshots returned are the caller's to keep: the provider does not write to them after returning them (see InputSourceSnapshot).
Returns
readonly InputSourceSnapshot[]
Implementation of
InputProvider.sample
setPresenceModality()
setPresenceModality(_mode: PresenceModality): boolean;
Defined in: threejs-interactions/src/webxr-provider.ts:463
Always false. Switching between hand and controller models means owning both, and this provider owns neither - the app registered one root per side and decides for itself what that root contains. IWSDK builds both families, so its adapter implements this.
Parameters
| Parameter | Type |
|---|---|
_mode | PresenceModality |
Returns
boolean
Implementation of
InputProvider.setPresenceModality
setPresenceVisible()
setPresenceVisible(target: Handedness | "all", visible: boolean): boolean;
Defined in: threejs-interactions/src/webxr-provider.ts:444
Show or hide registered visuals. Returns false when the targeted side
has no registered visual. "none" targets no side, so it reports
whether presence is usable at all without changing anything.
Parameters
| Parameter | Type |
|---|---|
target | Handedness | "all" |
visible | boolean |
Returns
boolean
Implementation of
InputProvider.setPresenceVisible
unregisterVisual()
unregisterVisual(handedness: "left" | "right"): boolean;
Defined in: threejs-interactions/src/webxr-provider.ts:433
Give a side's visual back, for an app that tears its models down.
Dropping the last one turns capabilities.presence off again.
Returns false when that side had nothing registered.
Parameters
| Parameter | Type |
|---|---|
handedness | "left" | "right" |
Returns
boolean