Skip to main content

Class: WorldOptions

Defined in: src/world/WorldOptions.ts:13

Constructors

Constructor

new WorldOptions(options?): WorldOptions

Defined in: src/world/WorldOptions.ts:26

Parameters

options?
anchors?

{ debugging?: boolean; enable?: () => AnchorsOptions; enabled?: boolean; enablePersistence?: () => AnchorsOptions; maxStoredAnchors?: number; persistent?: boolean; simulatorFallback?: boolean; storageKey?: string; } = ...

anchors.debugging?

boolean = false

Logs anchor lifecycle transitions.

anchors.enable?

() => AnchorsOptions

anchors.enabled?

boolean = false

Whether the anchor subsystem is created at all.

anchors.enablePersistence?

() => AnchorsOptions

anchors.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.

anchors.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.

anchors.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.

anchors.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.

debugging?

boolean = false

enableAnchorPersistence?

() => WorldOptions

enableAnchors?

() => WorldOptions

enabled?

boolean = false

enableFaceDetection?

() => WorldOptions

enableHumanDetection?

() => WorldOptions

enableMeshDetection?

() => WorldOptions

enableObjectDetection?

() => WorldOptions

enablePlaneDetection?

() => WorldOptions

enableSegmentation?

() => WorldOptions

enableSoundDetection?

() => WorldOptions

faces?

{ backendConfig?: { activeBackend?: string; mediapipe?: { minFaceDetectionConfidence?: number; minFacePresenceConfidence?: number; minTrackingConfidence?: number; modelAssetPath?: string; numFaces?: number; outputFaceBlendshapes?: boolean; outputFacialTransformationMatrixes?: boolean; wasmFilesUrl?: string; }; }; enable?: () => FacesOptions; enabled?: boolean; pollingIntervalMs?: number; } = ...

faces.backendConfig?

{ activeBackend?: string; mediapipe?: { minFaceDetectionConfidence?: number; minFacePresenceConfidence?: number; minTrackingConfidence?: number; modelAssetPath?: string; numFaces?: number; outputFaceBlendshapes?: boolean; outputFacialTransformationMatrixes?: boolean; wasmFilesUrl?: string; }; } = ...

Configuration options for the active face detection backend.

faces.backendConfig.activeBackend?

string = 'mediapipe'

faces.backendConfig.mediapipe?

{ minFaceDetectionConfidence?: number; minFacePresenceConfidence?: number; minTrackingConfidence?: number; modelAssetPath?: string; numFaces?: number; outputFaceBlendshapes?: boolean; outputFacialTransformationMatrixes?: boolean; wasmFilesUrl?: string; } = ...

faces.backendConfig.mediapipe.minFaceDetectionConfidence?

number = 0.5

The minimum confidence score [0.0, 1.0] required for a face to be detected.

faces.backendConfig.mediapipe.minFacePresenceConfidence?

number = 0.5

The minimum confidence score [0.0, 1.0] required to confirm a face is still present.

faces.backendConfig.mediapipe.minTrackingConfidence?

number = 0.5

The minimum confidence score [0.0, 1.0] required for tracking landmarks between frames.

faces.backendConfig.mediapipe.modelAssetPath?

string = 'https://storage.googleapis.com/mediapipe-models/face_landmarker/face_landmarker/float16/latest/face_landmarker.task'

faces.backendConfig.mediapipe.numFaces?

number = 1

The maximum number of simultaneous faces to track.

faces.backendConfig.mediapipe.outputFaceBlendshapes?

boolean = true

Whether to compute and emit per-face blendshape weights (52 ARKit-compatible categories). Required for facial expression mirroring, lipsync feeds, and avatar animation.

faces.backendConfig.mediapipe.outputFacialTransformationMatrixes?

boolean = true

Whether to compute and emit the 4x4 facial transformation matrix for each face. Provides a stable rigid head pose for parenting objects to the head (glasses, masks, hats).

faces.backendConfig.mediapipe.wasmFilesUrl?

string = 'https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm'

faces.enable?

() => FacesOptions

faces.enabled?

boolean = false

faces.pollingIntervalMs?

number = 0

Minimum delay in milliseconds between continuous face detection runs. A value of 0 runs again as soon as the previous detection finishes.

humans?

{ backendConfig?: { activeBackend?: string; mediapipe?: { minPoseDetectionConfidence?: number; minPosePresenceConfidence?: number; minTrackingConfidence?: number; modelAssetPath?: string; numPoses?: number; useWorker?: boolean; wasmFilesUrl?: string; }; }; enable?: () => HumansOptions; enabled?: boolean; pollingIntervalMs?: number; useDepthProjection?: boolean; } = ...

humans.backendConfig?

{ activeBackend?: string; mediapipe?: { minPoseDetectionConfidence?: number; minPosePresenceConfidence?: number; minTrackingConfidence?: number; modelAssetPath?: string; numPoses?: number; useWorker?: boolean; wasmFilesUrl?: string; }; } = ...

Configuration options for the active pose detection backend.

humans.backendConfig.activeBackend?

string = 'mediapipe'

humans.backendConfig.mediapipe?

{ minPoseDetectionConfidence?: number; minPosePresenceConfidence?: number; minTrackingConfidence?: number; modelAssetPath?: string; numPoses?: number; useWorker?: boolean; wasmFilesUrl?: string; } = ...

humans.backendConfig.mediapipe.minPoseDetectionConfidence?

number = 0.5

The minimum confidence score [0.0, 1.0] required for a pose to be detected.

humans.backendConfig.mediapipe.minPosePresenceConfidence?

number = 0.5

The minimum confidence score [0.0, 1.0] required to confirm a pose is still present.

humans.backendConfig.mediapipe.minTrackingConfidence?

number = 0.5

The minimum confidence score [0.0, 1.0] required for tracking landmarks between frames.

humans.backendConfig.mediapipe.modelAssetPath?

string = 'https://storage.googleapis.com/mediapipe-models/pose_landmarker/pose_landmarker_full/float16/latest/pose_landmarker_full.task'

humans.backendConfig.mediapipe.numPoses?

number = 1

The maximum number of simultaneous human poses/bodies to track.

humans.backendConfig.mediapipe.useWorker?

boolean = true

Run inference in a web worker so a detection pass does not stall the render loop. The worker is limited to the CPU delegate because MediaPipe only creates a GPU surface for a real DOM canvas, so set this to false to trade a blocked main thread for GPU inference. Falls back to the main thread automatically when workers are unavailable.

humans.backendConfig.mediapipe.wasmFilesUrl?

string = 'https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm'

humans.enable?

() => HumansOptions

humans.enabled?

boolean = false

humans.pollingIntervalMs?

number = 0

Minimum delay in milliseconds between continuous pose detection runs. A value of 0 runs again as soon as the previous detection finishes.

humans.useDepthProjection?

boolean = true

Project each landmark onto the depth mesh to find its world position.

This is what you want when the people being detected are physically in front of you, since the ray lands on their actual body. Turn it off when the camera is showing someone who is not part of the depth scene, such as a webcam feed on the desktop simulator: every ray would then hit the surrounding geometry instead and the skeleton would be smeared across it. With projection off, landmarks are placed along the view ray at a fixed distance, which keeps the body correctly proportioned.

initiateRoomCapture?

boolean = false

meshes?

{ enable?: () => MeshDetectionOptions; enabled?: boolean; showDebugVisualizations?: boolean; } = ...

meshes.enable?

() => MeshDetectionOptions

meshes.enabled?

boolean = false

meshes.showDebugVisualizations?

boolean = false

objects?

{ backendConfig?: { activeBackend?: "gemini" | "mediapipe"; gemini?: { generationConfig?: {[key: string]: unknown; }; responseSchema?: { items?: ... | ...; type?: ... | ...; }; systemInstruction?: string; }; mediapipe?: { modelAssetPath?: string; scoreThreshold?: number; wasmFilesUrl?: string; }; }; debugging?: boolean; enable?: () => ObjectsOptions; enabled?: boolean; objectImageMargin?: number; pollingIntervalMs?: number; showDebugVisualizations?: boolean; simulatorOverride?: boolean; } = ...

objects.backendConfig?

{ activeBackend?: "gemini" | "mediapipe"; gemini?: { generationConfig?: {[key: string]: unknown; }; responseSchema?: { items?: ... | ...; type?: ... | ...; }; systemInstruction?: string; }; mediapipe?: { modelAssetPath?: string; scoreThreshold?: number; wasmFilesUrl?: string; }; } = ...

Configuration for the detection backends.

objects.backendConfig.activeBackend?

"gemini" | "mediapipe" = ...

The active backend to use for detection.

objects.backendConfig.gemini?

{ generationConfig?: {[key: string]: unknown; }; responseSchema?: { items?: ... | ...; type?: ... | ...; }; systemInstruction?: string; } = ...

objects.backendConfig.gemini.generationConfig?

{[key: string]: unknown; } = ...

Extra Gemini generation config merged into the per-call config (over the SDK defaults). Use to pin sampling parameters such as temperature: 0 for deterministic detections.

objects.backendConfig.gemini.responseSchema?

{ items?: ... | ...; type?: ... | ...; } = ...

objects.backendConfig.gemini.responseSchema.items?

... | ... = ...

objects.backendConfig.gemini.responseSchema.type?

... | ... = 'ARRAY'

objects.backendConfig.gemini.systemInstruction?

string = ...

objects.backendConfig.mediapipe?

{ modelAssetPath?: string; scoreThreshold?: number; wasmFilesUrl?: string; } = ...

Configuration for MediaPipe backend.

objects.backendConfig.mediapipe.modelAssetPath?

string = 'https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite2/int8/latest/efficientdet_lite2.tflite'

objects.backendConfig.mediapipe.scoreThreshold?

number = 0.5

objects.backendConfig.mediapipe.wasmFilesUrl?

string = 'https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.34/wasm'

objects.debugging?

boolean = false

objects.enable?

() => ObjectsOptions

objects.enabled?

boolean = false

objects.objectImageMargin?

number = 0.05

Margin to add when cropping the object image, as a percentage of image size.

objects.pollingIntervalMs?

number = 0

Minimum delay in milliseconds between continuous object detection runs. A value of 0 runs again as soon as the previous detection finishes.

objects.showDebugVisualizations?

boolean = false

objects.simulatorOverride?

boolean = false

Use simulator ground truth instead of a camera detector on desktop.

planes?

{ debugging?: boolean; enable?: () => PlanesOptions; enabled?: boolean; showDebugVisualizations?: boolean; } = ...

planes.debugging?

boolean = false

planes.enable?

() => PlanesOptions

planes.enabled?

boolean = false

planes.showDebugVisualizations?

boolean = false

segmentation?

{ backendConfig?: { activeBackend?: string; mediapipe?: { modelAssetPath?: string; outputCategoryMask?: boolean; wasmFilesUrl?: string; }; }; enable?: () => SegmentationOptions; enabled?: boolean; pollingIntervalMs?: number; } = ...

segmentation.backendConfig?

{ activeBackend?: string; mediapipe?: { modelAssetPath?: string; outputCategoryMask?: boolean; wasmFilesUrl?: string; }; } = ...

Configuration options for the active segmentation backend.

segmentation.backendConfig.activeBackend?

string = 'mediapipe'

segmentation.backendConfig.mediapipe?

{ modelAssetPath?: string; outputCategoryMask?: boolean; wasmFilesUrl?: string; } = ...

segmentation.backendConfig.mediapipe.modelAssetPath?

string = ...

segmentation.backendConfig.mediapipe.outputCategoryMask?

boolean = true

Output the per-pixel category mask. Required to produce a SegmentationMask.

segmentation.backendConfig.mediapipe.wasmFilesUrl?

string = 'https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@latest/wasm'

segmentation.enable?

() => SegmentationOptions

segmentation.enabled?

boolean = false

segmentation.pollingIntervalMs?

number = 66

Minimum delay in milliseconds between continuous segmentation runs. A value of 0 runs again as soon as the previous inference finishes. Defaults to 66 (~15 fps), the rate the magic_window grab loop used before segmentation moved onto its own polling loop.

sounds?

{ backendConfig?: { activeBackend?: string; mediapipe?: { chunkSamples?: number; modelAssetPath?: string; wasmFilesUrl?: string; }; }; enable?: () => SoundsOptions; enabled?: boolean; showDebugInfo?: boolean; } = ...

sounds.backendConfig?

{ activeBackend?: string; mediapipe?: { chunkSamples?: number; modelAssetPath?: string; wasmFilesUrl?: string; }; } = ...

sounds.backendConfig.activeBackend?

string = 'mediapipe'

sounds.backendConfig.mediapipe?

{ chunkSamples?: number; modelAssetPath?: string; wasmFilesUrl?: string; } = ...

sounds.backendConfig.mediapipe.chunkSamples?

number = 16000

sounds.backendConfig.mediapipe.modelAssetPath?

string = 'https://tfhub.dev/google/lite-model/yamnet/classification/tflite/1?lite-format=tflite'

sounds.backendConfig.mediapipe.wasmFilesUrl?

string = 'https://cdn.jsdelivr.net/npm/@mediapipe/tasks-audio@0.10.35/wasm'

sounds.enable?

() => SoundsOptions

sounds.enabled?

boolean = false

sounds.showDebugInfo?

boolean = false

Returns

WorldOptions

Properties

anchors

anchors: AnchorsOptions

Defined in: src/world/WorldOptions.ts:24


debugging

debugging: boolean = false

Defined in: src/world/WorldOptions.ts:14


enabled

enabled: boolean = false

Defined in: src/world/WorldOptions.ts:15


faces

faces: FacesOptions

Defined in: src/world/WorldOptions.ts:22


humans

humans: HumansOptions

Defined in: src/world/WorldOptions.ts:21


initiateRoomCapture

initiateRoomCapture: boolean = false

Defined in: src/world/WorldOptions.ts:16


meshes

meshes: MeshDetectionOptions

Defined in: src/world/WorldOptions.ts:19


objects

objects: ObjectsOptions

Defined in: src/world/WorldOptions.ts:18


planes

planes: PlanesOptions

Defined in: src/world/WorldOptions.ts:17


segmentation

segmentation: SegmentationOptions

Defined in: src/world/WorldOptions.ts:23


sounds

sounds: SoundsOptions

Defined in: src/world/WorldOptions.ts:20

Methods

enableAnchorPersistence()

enableAnchorPersistence(): WorldOptions

Defined in: src/world/WorldOptions.ts:72

Enables spatial anchors and saves their handles so anchored content can be restored in a later session.

Returns

WorldOptions


enableAnchors()

enableAnchors(): WorldOptions

Defined in: src/world/WorldOptions.ts:62

Enables spatial anchors.

Returns

WorldOptions


enableFaceDetection()

enableFaceDetection(): WorldOptions

Defined in: src/world/WorldOptions.ts:99

Enables face landmark detection.

Returns

WorldOptions


enableHumanDetection()

enableHumanDetection(): WorldOptions

Defined in: src/world/WorldOptions.ts:90

Enables human detection.

Returns

WorldOptions


enableMeshDetection()

enableMeshDetection(): WorldOptions

Defined in: src/world/WorldOptions.ts:53

Enables mesh detection.

Returns

WorldOptions


enableObjectDetection()

enableObjectDetection(): WorldOptions

Defined in: src/world/WorldOptions.ts:44

Enables object detection.

Returns

WorldOptions


enablePlaneDetection()

enablePlaneDetection(): WorldOptions

Defined in: src/world/WorldOptions.ts:35

Enables plane detection.

Returns

WorldOptions


enableSegmentation()

enableSegmentation(): WorldOptions

Defined in: src/world/WorldOptions.ts:108

Enables semantic segmentation (person / background category masks).

Returns

WorldOptions


enableSoundDetection()

enableSoundDetection(): WorldOptions

Defined in: src/world/WorldOptions.ts:81

Enables sound detection.

Returns

WorldOptions