Skip to main content

Class: AnchorsOptions

Defined in: src/world/anchors/AnchorsOptions.ts:33

Configuration for the spatial anchor subsystem.

Anchors pin content to a real place so the platform keeps it there as its understanding of the room improves. With AnchorsOptions.persistent enabled, anchor handles are saved so the same content can be restored in a later session.

Constructors​

Constructor​

new AnchorsOptions(options?): AnchorsOptions

Defined in: src/world/anchors/AnchorsOptions.ts:74

Parameters​

options?​
debugging?​

boolean = false

Logs anchor lifecycle transitions.

enable?​

() => AnchorsOptions

enabled?​

boolean = false

Whether the anchor subsystem is created at all.

enablePersistence?​

() => AnchorsOptions

maxStoredAnchors?​

number = 128

Upper bound on saved handles. Persistent handles accumulate across sessions and would otherwise grow without limit; the oldest are evicted first once the cap is reached.

persistent?​

boolean = false

Whether anchor handles are saved so they can be restored in a later session. Requires platform support for persistent handles; when the platform only offers session-scoped anchors this degrades to in-session behaviour rather than failing.

simulatorFallback?​

boolean = false

Whether to hold poses locally when the platform has no anchor support.

Off by default: on a real headset a silent stand-in would look like working anchors while nothing is actually pinned. Demos and desktop development opt in deliberately.

storageKey?​

string = ...

Storage key used when persistence is enabled.

Defaults to a page-scoped key. Set it explicitly to share anchors between pages, or to keep a stable key if the app might move path.

Returns​

AnchorsOptions

Properties​

debugging​

debugging: boolean = false

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

Logs anchor lifecycle transitions.


enabled​

enabled: boolean = false

Defined in: src/world/anchors/AnchorsOptions.ts:38

Whether the anchor subsystem is created at all.


maxStoredAnchors​

maxStoredAnchors: number = 128

Defined in: src/world/anchors/AnchorsOptions.ts:72

Upper bound on saved handles. Persistent handles accumulate across sessions and would otherwise grow without limit; the oldest are evicted first once the cap is reached.


persistent​

persistent: boolean = false

Defined in: src/world/anchors/AnchorsOptions.ts:46

Whether anchor handles are saved so they can be restored in a later session. Requires platform support for persistent handles; when the platform only offers session-scoped anchors this degrades to in-session behaviour rather than failing.


simulatorFallback​

simulatorFallback: boolean = false

Defined in: src/world/anchors/AnchorsOptions.ts:55

Whether to hold poses locally when the platform has no anchor support.

Off by default: on a real headset a silent stand-in would look like working anchors while nothing is actually pinned. Demos and desktop development opt in deliberately.


storageKey​

storageKey: string

Defined in: src/world/anchors/AnchorsOptions.ts:63

Storage key used when persistence is enabled.

Defaults to a page-scoped key. Set it explicitly to share anchors between pages, or to keep a stable key if the app might move path.

Methods​

enable()​

enable(): AnchorsOptions

Defined in: src/world/anchors/AnchorsOptions.ts:84

Enables anchors.

Returns​

AnchorsOptions

This options object, for chaining.


enablePersistence()​

enablePersistence(): AnchorsOptions

Defined in: src/world/anchors/AnchorsOptions.ts:93

Enables anchors and saves handles for restoration in later sessions.

Returns​

AnchorsOptions

This options object, for chaining.