Skip to main content

Class: InteractionRuntime

Defined in: runtime.ts:106

Constructors​

Constructor​

new InteractionRuntime(options: InteractionRuntimeOptions): InteractionRuntime;

Defined in: runtime.ts:122

Parameters​

ParameterType
optionsInteractionRuntimeOptions

Returns​

InteractionRuntime

Methods​

dispose()​

dispose(): void;

Defined in: runtime.ts:309

Returns​

void


getBehaviour()​

getBehaviour<T extends Behaviour = Behaviour>(interactableId: string, kind: string): T | undefined;

Defined in: runtime.ts:195

Reach a live behaviour instance for tuning (playground steppers).

Type Parameters​

Type ParameterDefault type
T extends BehaviourBehaviour

Parameters​

ParameterType
interactableIdstring
kindstring

Returns​

T | undefined


getCapabilities()​

getCapabilities(): InputCapabilities;

Defined in: runtime.ts:267

Returns​

InputCapabilities


getInteractableIds()​

getInteractableIds(): string[];

Defined in: runtime.ts:216

Returns​

string[]


getProvider()​

getProvider(): InputProvider;

Defined in: runtime.ts:271

Returns​

InputProvider


getSource()​

getSource(id: string): InputSourceSnapshot | undefined;

Defined in: runtime.ts:263

The last sample of one source, velocity included. Undefined before the first update, and once the source stops reporting.

The snapshot is the caller's to keep: it is never mutated after the frame it was sampled in, and it is not refreshed in place, so call again for a newer one.

Parameters​

ParameterType
idstring

Returns​

InputSourceSnapshot | undefined


getState()​

getState(id: string): InteractableState | undefined;

Defined in: runtime.ts:200

Parameters​

ParameterType
idstring

Returns​

InteractableState | undefined


onEvent()​

onEvent(listener: InteractionEventListener): Unsubscribe;

Defined in: runtime.ts:222

Parameters​

ParameterType
listenerInteractionEventListener

Returns​

Unsubscribe


onFeedback()​

onFeedback(listener: FeedbackListener): Unsubscribe;

Defined in: runtime.ts:226

Parameters​

ParameterType
listenerFeedbackListener

Returns​

Unsubscribe


onSample()​

onSample(listener: (sources: readonly InputSourceSnapshot[]) => void): Unsubscribe;

Defined in: runtime.ts:251

This frame's sources, velocity included.

The snapshots are the provider's own objects for this frame and are never written to again once delivered (the ownership rule on InputSourceSnapshot), so a listener may keep one, or a tuple inside it, across frames without copying.

Parameters​

ParameterType
listener(sources: readonly InputSourceSnapshot[]) => void

Returns​

Unsubscribe


onSourcesSampled()​

onSourcesSampled(listener: (sources: readonly InputSourceSnapshot[]) => void): Unsubscribe;

Defined in: runtime.ts:239

Sampled sources for this frame - the UI Extensions pointer bridge hook.

Parameters​

ParameterType
listener(sources: readonly InputSourceSnapshot[]) => void

Returns​

Unsubscribe

Deprecated​

Use onSample. Both deliver the same stream: since @realitycollective/webxr-input 0.1.1 carries linearVelocity and angularVelocity on InputSourceSnapshot, the two signatures are identical and only one name is needed. This one is kept so existing callers keep working and will be removed in a later major release.


registerInteractable()​

registerInteractable(def: InteractableDescriptor, ports?: RegisterPorts): void;

Defined in: runtime.ts:142

Parameters​

ParameterType
defInteractableDescriptor
portsRegisterPorts

Returns​

void


setHitTester()​

setHitTester(hitTester: HitTester | null): void;

Defined in: runtime.ts:190

Parameters​

ParameterType
hitTesterHitTester | null

Returns​

void


setInteractableEnabled()​

setInteractableEnabled(id: string, enabled: boolean): void;

Defined in: runtime.ts:179

Parameters​

ParameterType
idstring
enabledboolean

Returns​

void


unregisterInteractable()​

unregisterInteractable(id: string): void;

Defined in: runtime.ts:172

Parameters​

ParameterType
idstring

Returns​

void


update()​

update(dt: number): void;

Defined in: runtime.ts:277

Parameters​

ParameterType
dtnumber

Returns​

void