Skip to main content

Class: SimulatorAnchor

Defined in: src/world/anchors/SimulatorAnchor.ts:18

A stand-in anchor for environments with no WebXR anchor support.

The desktop simulator has no tracking system to anchor against, so this holds the pose itself. It is deliberately a separate type rather than a silent substitute: anchoring here proves the app's own wiring, not that the platform can re-localise anything, and callers can tell the difference via SimulatorAnchor.isSimulatorAnchor.

Constructors

Constructor

new SimulatorAnchor(handle, pose): SimulatorAnchor

Defined in: src/world/anchors/SimulatorAnchor.ts:35

Parameters

handle

string

Identifier used as this anchor's persistent handle.

pose

XRRigidTransform

Pose to hold.

Returns

SimulatorAnchor

Properties

anchorSpace

readonly anchorSpace: XRSpace

Defined in: src/world/anchors/SimulatorAnchor.ts:23

Stands in for XRAnchor.anchorSpace; never a real tracked space.


isSimulatorAnchor

readonly isSimulatorAnchor: true = true

Defined in: src/world/anchors/SimulatorAnchor.ts:20

Marks the instance so it can be recognised after type erasure.


pose

readonly pose: object

Defined in: src/world/anchors/SimulatorAnchor.ts:26

The pose this anchor was created at.

orientation

orientation: object

orientation.w

w: number

orientation.x

x: number

orientation.y

y: number

orientation.z

z: number

position

position: object

position.x

x: number

position.y

y: number

position.z

z: number

Methods

delete()

delete(): void

Defined in: src/world/anchors/SimulatorAnchor.ts:61

Matches the XRAnchor.delete shape; nothing to release.

Returns

void


requestPersistentHandle()

requestPersistentHandle(): Promise<string>

Defined in: src/world/anchors/SimulatorAnchor.ts:58

Returns this anchor's handle.

Returns

Promise<string>

The handle it was constructed with.


toStorablePose()

toStorablePose(): StorablePose

Defined in: src/world/anchors/SimulatorAnchor.ts:67

The held pose in storable form.

Returns

StorablePose

The pose as plain arrays.


fromStorablePose()

static fromStorablePose(handle, pose): SimulatorAnchor

Defined in: src/world/anchors/SimulatorAnchor.ts:89

Rebuilds an anchor from a stored pose.

Parameters

handle

string

Handle to restore under.

pose

StorablePose

Previously stored pose.

Returns

SimulatorAnchor

The rebuilt anchor.


isSimulatorAnchor()

static isSimulatorAnchor(anchor): anchor is SimulatorAnchor

Defined in: src/world/anchors/SimulatorAnchor.ts:110

Whether an anchor is simulated rather than platform-provided.

Parameters

anchor

unknown

Anchor to test.

Returns

anchor is SimulatorAnchor

True when the anchor is a SimulatorAnchor.