Skip to main content

Class: ThreeWorldSensingPort

Defined in: threejs-environment/src/world-sensing-port.ts:96

What an adapter implements. Everything except observe is optional, because every host has a different subset and a missing method is reported rather than thrown.

Implements

Constructors

Constructor

new ThreeWorldSensingPort(renderer: XrRendererLike, options?: ThreeWorldSensingPortOptions): ThreeWorldSensingPort;

Defined in: threejs-environment/src/world-sensing-port.ts:110

Parameters

ParameterType
rendererXrRendererLike
optionsThreeWorldSensingPortOptions

Returns

ThreeWorldSensingPort

Methods

createAnchor()

createAnchor(pose: WorldPose): Promise<string | null>;

Defined in: threejs-environment/src/world-sensing-port.ts:213

Ask the runtime to remember a point. Resolves to the anchor's id, or null when the runtime refused. Anchors then arrive through host.anchors like any other, so an app can treat its own and the system's the same way.

Parameters

ParameterType
poseWorldPose

Returns

Promise<string | null>

Implementation of

WorldSensingPort.createAnchor


dispose()

dispose(): void;

Defined in: threejs-environment/src/world-sensing-port.ts:280

Returns

void

Implementation of

WorldSensingPort.dispose


observe()

observe(host: WorldSensingPortHost): () => void;

Defined in: threejs-environment/src/world-sensing-port.ts:116

Parameters

ParameterType
hostWorldSensingPortHost

Returns

() => void

Implementation of

WorldSensingPort.observe


removeAnchor()

removeAnchor(id: string): void;

Defined in: threejs-environment/src/world-sensing-port.ts:245

Parameters

ParameterType
idstring

Returns

void

Implementation of

WorldSensingPort.removeAnchor


setDetection()

setDetection(detection:
| ResolvedWorldDetection
| null): void;

Defined in: threejs-environment/src/world-sensing-port.ts:123

Turn detection on or off. null means stop everything.

Parameters

ParameterType
detection| ResolvedWorldDetection | null

Returns

void

Implementation of

WorldSensingPort.setDetection


startHitTest()

startHitTest(request: HitTestRequest): void;

Defined in: threejs-environment/src/world-sensing-port.ts:171

Start a standing hit test.

A hand ray is cast from the INPUT SOURCE, not from the head. WebXR binds a hit-test source to a space, and the space for a hand or controller is that source's targetRaySpace - so this looks the source up by handedness and binds to it. Input sources come and go (a hand leaves the view, a controller wakes up), so a request that cannot be bound yet stays pending and is retried on every frame, and one whose source disappears is unbound and rebound rather than left aiming at nothing.

Parameters

ParameterType
requestHitTestRequest

Returns

void

Implementation of

WorldSensingPort.startHitTest


stopHitTest()

stopHitTest(id: string): void;

Defined in: threejs-environment/src/world-sensing-port.ts:205

Parameters

ParameterType
idstring

Returns

void

Implementation of

WorldSensingPort.stopHitTest


update()

update(): void;

Defined in: threejs-environment/src/world-sensing-port.ts:254

Called from the director's update; this is where a port polls its host.

Returns

void

Implementation of

WorldSensingPort.update