### start() Source: https://xrblocks.github.io/docs/api/classes/Agent Starts the agent's reasoning loop with an initial prompt. ```APIDOC ## start(prompt) ### Description Starts the agent's reasoning loop with an initial prompt. ### Parameters #### prompt `string` - The initial prompt from the user. ### Returns `Promise` - The final text response from the agent. ``` -------------------------------- ### startCapture Source: https://xrblocks.github.io/docs/api/classes/AudioListener Starts capturing audio with specified callbacks. ```APIDOC ## startCapture() ### Description Starts audio capture. ### Method `startCapture(callbacks: { accumulate?: boolean, onAudioData?: (audioBuffer: ArrayBuffer) => void, onError?: (error: any) => void }): Promise` ### Parameters #### callbacks - **accumulate** (boolean) - Optional. If true, audio data will be accumulated. - **onAudioData** ((audioBuffer: ArrayBuffer) => void) - Optional. Callback function for received audio data. - **onError** ((error: any) => void) - Optional. Callback function for errors. ### Returns - `Promise` - A promise that resolves when audio capture starts. ``` -------------------------------- ### start() Source: https://xrblocks.github.io/docs/api/classes/SpeechRecognizer Starts the speech recognition process. This method is defined in src/sound/SpeechRecognizer.ts. ```APIDOC ## start() ### Description Starts the speech recognition process. ### Method `start()` ### Returns `void` ``` -------------------------------- ### onXRSessionStarted Source: https://xrblocks.github.io/docs/api/classes/AudioPlayer Callback for when the XR session starts. ```APIDOC ## onXRSessionStarted ### Description Callback for when the XR session starts. ### Method `onXRSessionStarted(_session?: XRSession): void` ### Parameters #### _session - `XRSession` (Optional) ### Returns - `void` ### Inherited from `Script`.`onXRSessionStarted` ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/functions/init Initializes the XR Blocks system and starts the render loop. This is the main entry point for any application. ```APIDOC ## Function: init() > **init**(`options`): `Promise`<`void`> Defined in: src/singletons.ts:94 A shortcut for `core.init()`. Initializes the XR Blocks system and starts the render loop. This is the main entry point for any application. ### Parameters​ #### options​ `Options` = `...` Configuration options for the session. ### Returns​ `Promise`<`void`> ### See​ Core.init ``` -------------------------------- ### onSimulatorStarted Source: https://xrblocks.github.io/docs/api/classes/DepthMesh Callback for when the simulator starts. ```APIDOC ## onSimulatorStarted() ### Description Called when the simulator starts. ### Returns - `void` ### Inherited from `MeshScript`.`onSimulatorStarted` ``` -------------------------------- ### onSimulatorStarted Source: https://xrblocks.github.io/docs/api/classes/AudioPlayer Callback for when the simulator starts. ```APIDOC ## onSimulatorStarted ### Description Callback for when the simulator starts. ### Method `onSimulatorStarted(): void` ### Returns - `void` ### Inherited from `Script`.`onSimulatorStarted` ``` -------------------------------- ### startLiveSession() Source: https://xrblocks.github.io/docs/api/classes/Gemini Starts a new live session with the AI model. ```APIDOC ## startLiveSession() > **startLiveSession**(`params`, `model?`): `Promise`<`Session`> #### Parameters ##### params `LiveConnectConfig` = `{}` ##### model? `string` #### Returns `Promise`<`Session`> ``` -------------------------------- ### onSelectStart Source: https://xrblocks.github.io/docs/api/classes/AudioPlayer Called whenever pinch / mouse click starts, globally. ```APIDOC ## onSelectStart ### Description Called whenever pinch / mouse click starts, globally. ### Method `onSelectStart(_event: SelectEvent): void` ### Parameters #### _event - `SelectEvent`: event.target holds its controller ### Returns - `void` ### Inherited from `Script`.`onSelectStart` ``` -------------------------------- ### onSelectStart Source: https://xrblocks.github.io/docs/api/classes/DepthMesh Called whenever pinch / mouse click starts, globally. ```APIDOC ## onSelectStart() ### Description Called whenever pinch / mouse click starts, globally. ### Parameters #### _event - `SelectEvent` event.target holds its controller ### Returns - `void` ### Inherited from `MeshScript`.`onSelectStart` ``` -------------------------------- ### getElapsedTime() Source: https://xrblocks.github.io/docs/api/functions/getElapsedTime A shortcut for `core.timer.getElapsed()`. Gets the total time in seconds since the application started. ```APIDOC ## Function: getElapsedTime() > **getElapsedTime**(): `number` Defined in: src/singletons.ts:134 A shortcut for `core.timer.getElapsed()`. Gets the total time in seconds since the application started. ## Returns `number` The elapsed time in seconds. ## See THREE.Timer.getElapsed ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/Core Initializes the Core system with configuration options, setting up the renderer, enabling features, and starting the render loop. ```APIDOC ## init(options) ### Description Initializes the Core system with a given set of options. This includes setting up the renderer, enabling features like controllers, depth sensing, and physics, and starting the render loop. ### Parameters #### options - `options` (Options) - Required - Configuration options for the session. ### Returns `Promise` - A promise that resolves when the initialization is complete. ``` -------------------------------- ### setupPlatform() Source: https://xrblocks.github.io/docs/api/classes/ModelViewer Sets up the platform for the model with a specified margin. ```APIDOC ## setupPlatform() ### Description Sets up the platform for the model with a specified margin. ### Method `setupPlatform(platformMargin)` ### Parameters #### Path Parameters - **platformMargin** (Vector2) - Optional - Defaults to `defaultPlatformMargin`. The margin for the platform. ### Returns `void` ``` -------------------------------- ### TypeScript tsconfig.json Setup for Rapier Source: https://xrblocks.github.io/docs/manual/Physics Configure your tsconfig.json to link the virtual 'rapier3d' import to your installed Rapier package. This is necessary for TypeScript to correctly resolve Rapier types when using XR Blocks. ```json { "compilerOptions": { "paths": { "rapier3d": ["./node_modules/@dimforge/rapier3d-simd-compat/rapier"] } } //... } ``` -------------------------------- ### startSimulator Method Source: https://xrblocks.github.io/docs/api/classes/XRButton Initiates the XR simulator. This method is called when the simulator start button is activated. ```APIDOC ## Method: startSimulator > **startSimulator**(): `void` ### Description Starts the XR simulator. ### Returns * `void` ``` -------------------------------- ### setupAudioCapture Source: https://xrblocks.github.io/docs/api/classes/AudioListener Initializes the audio capture system. ```APIDOC ## setupAudioCapture() ### Description Sets up the audio capture system. ### Method `setupAudioCapture(): Promise` ### Returns - `Promise` - A promise that resolves when audio capture is set up. ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/AI Initializes an instance with XR controllers, grips, hands, raycaster, and default options. ```APIDOC ## init() > **init**(`__namedParameters`): `Promise`<`void`> Defined in: src/ai/AI.ts:81 Initializes an instance with XR controllers, grips, hands, raycaster, and default options. We allow all scripts to quickly access its user (e.g., user.isSelecting(), user.hands), world (e.g., physical depth mesh, lighting estimation, and recognized objects), and scene (the root of three.js's scene graph). If this returns a promise, we will wait for it. #### Parameters​ ##### __namedParameters​ ###### aiOptions​ `AIOptions` #### Returns​ `Promise`<`void`> #### Overrides​ `Script`.`init` ``` -------------------------------- ### Start and Manage SkyboxAgent Live Session Source: https://xrblocks.github.io/docs/api/classes/SkyboxAgent Enables audio, creates a SkyboxAgent instance, starts a live session with event callbacks, and cleans up resources. Ensure audio is enabled before starting the session. ```typescript // 1. Enable audio (required for live sessions) await xb.core.sound.enableAudio(); // 2. Create agent const agent = new xb.SkyboxAgent(xb.core.ai, xb.core.sound, xb.core.scene); // 3. Start session await agent.startLiveSession({ onopen: () => console.log('Session ready'), onmessage: (msg) => handleMessage(msg), onclose: () => console.log('Session closed') }); // 4. Clean up when done await agent.stopLiveSession(); xb.core.sound.disableAudio(); ``` -------------------------------- ### startLiveSession Source: https://xrblocks.github.io/docs/api/classes/AI Starts a live AI session with the specified configuration. Returns a promise that resolves to a Session object. ```APIDOC ## startLiveSession(config, model?) ### Description Starts a live AI session with the specified configuration. ### Parameters #### Path Parameters - **config** (LiveConnectConfig) - Required - The configuration for the live session. Defaults to an empty object. - **model** (string) - Optional - The specific AI model to use for the session. ### Returns `Promise` - A promise that resolves to the active session object. ``` -------------------------------- ### get rangeY() Source: https://xrblocks.github.io/docs/api/classes/ImageView Gets the effective vertical range for child elements, normalized to 1.0 for the smaller dimension. ```APIDOC ## get rangeY() ### Description Gets the effective vertical range for child elements, normalized to 1.0 for the smaller dimension. ### Method GET ### Endpoint N/A (Method call) ### Returns `number` - The vertical layout range. ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/SpatialAudio Initializes an instance with XR controllers, grips, hands, raycaster, and default options. Allows access to user, world, and scene data. Can return a promise. ```APIDOC ## init() > **init**(`_?`): `void` | `Promise`<`void`> ### Description Initializes an instance with XR controllers, grips, hands, raycaster, and default options. We allow all scripts to quickly access its user (e.g., user.isSelecting(), user.hands), world (e.g., physical depth mesh, lighting estimation, and recognized objects), and scene (the root of three.js's scene graph). If this returns a promise, we will wait for it. ### Parameters #### _? `object` ### Returns `void` | `Promise`<`void`> ``` -------------------------------- ### onObjectGrabStart(_event) Source: https://xrblocks.github.io/docs/api/classes/AI Callback function executed when a hand starts grabbing an object. ```APIDOC ## onObjectGrabStart(_event) ### Description Called when a hand starts grabbing this object (touching + pinching). ### Method onObjectGrabStart(_event) ### Parameters #### Path Parameters - **_event** (`ObjectGrabEvent`) ### Returns `void` ### Inherited from `Script.onObjectGrabStart` ``` -------------------------------- ### Install XR Blocks via npm Source: https://xrblocks.github.io/docs/manual/Simulator Install the 'lit' package using npm if you are managing your project dependencies through npm. ```bash npm i lit ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/Grid Initializes an instance with XR controllers, grips, hands, raycaster, and default options. Allows access to user, world, and scene information. Can return a promise that will be awaited. ```APIDOC ## init() ### Description Initializes an instance with XR controllers, grips, hands, raycaster, and default options. We allow all scripts to quickly access its user (e.g., user.isSelecting(), user.hands), world (e.g., physical depth mesh, lighting estimation, and recognized objects), and scene (the root of three.js's scene graph). If this returns a promise, we will wait for it. ### Parameters #### _? - `_?` (object) - Description not provided. ### Returns - `void` | `Promise` ### Inherited from `View`.`init` ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/CoreSound Initializes an instance with XR controllers, grips, hands, raycaster, and default options. Allows quick access to user, world, and scene information. ```APIDOC ## init() ### Description Initializes an instance with XR controllers, grips, hands, raycaster, and default options. We allow all scripts to quickly access its user (e.g., user.isSelecting(), user.hands), world (e.g., physical depth mesh, lighting estimation, and recognized objects), and scene (the root of three.js's scene graph). If this returns a promise, we will wait for it. ### Parameters #### __namedParameters - **camera** (Camera) - Required - The XR camera. - **soundOptions** (SoundOptions) - Required - Options for sound configuration. ### Returns `void` ``` -------------------------------- ### setupRaycastBox() Source: https://xrblocks.github.io/docs/api/classes/ModelViewer Sets up a raycast box for interaction. ```APIDOC ## setupRaycastBox() ### Description Sets up a raycast box for interaction. ### Method `setupRaycastBox()` ### Returns `void` ``` -------------------------------- ### video Source: https://xrblocks.github.io/docs/api/classes/XRDeviceCamera Gets the HTMLVideoElement associated with the stream. ```APIDOC ## video #### Get Signature > **get** **video**(): `HTMLVideoElement` ##### Returns `HTMLVideoElement` ``` -------------------------------- ### init Source: https://xrblocks.github.io/docs/api/classes/PinchOnButtonAction Initializes the action with necessary dependencies. ```APIDOC ## init > **init**(`__namedParameters`): `Promise`<`void`> #### Parameters ##### __namedParameters ###### camera `Camera` ###### input `Input` ###### simulator `Simulator` ###### timer `Timer` #### Returns `Promise`<`void`> ``` -------------------------------- ### defaultOnSelectStart Source: https://xrblocks.github.io/docs/api/classes/Input Default action to handle the start of a selection, setting the selecting state to true. ```APIDOC ## defaultOnSelectStart() ### Description Default action to handle the start of a selection, setting the selecting state to true. ### Method `defaultOnSelectStart(event: ControllerEvent): void` ### Parameters #### event - **event** (ControllerEvent) - Description not provided. ``` -------------------------------- ### getControllerPosition Source: https://xrblocks.github.io/docs/api/classes/User Gets the world position of a controller. ```APIDOC ## getControllerPosition() ### Description Gets the world position of a controller. ### Method User.getControllerPosition ### Parameters #### id - **id** (number) - Required - The controller id. #### target - **target** (Vector3) - Optional - The target vector to store the result. ### Returns `Vector3` - The world position of the controller. ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/AudioListener Initializes the AudioListener with a registry. ```APIDOC ## init() > **init**(`__namedParameters`): `void` ### Description Init the AudioListener. ### Parameters #### __namedParameters ##### registry `Registry` ### Returns `void` ### Overrides `Script`.`init` ``` -------------------------------- ### get Source: https://xrblocks.github.io/docs/api/classes/Input Retrieves the controller object by its ID. ```APIDOC ## get() ### Description Retrieves the controller object by its ID. ### Method `get(id: number): Object3D` ### Parameters #### id - **id** (number) - Required - The ID of the controller. ### Returns - **Object3D** - The controller with the specified ID. ``` -------------------------------- ### ShowHandsAction.init() Source: https://xrblocks.github.io/docs/api/classes/ShowHandsAction Initializes the action with the simulator instance. ```APIDOC ## init(__namedParameters: { simulator: Simulator }): Promise ### Description Initializes the `ShowHandsAction` with the provided simulator. ### Parameters #### __namedParameters - **simulator** (`Simulator`) - The simulator instance to associate with this action. ### Returns `Promise` - A promise that resolves when the initialization is complete. ### Overrides `SimulatorUserAction.init` ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/SimulatorControls Initializes the simulator controls with necessary components. ```APIDOC ## init() ### Description Initialize the simulator controls. ### Parameters #### __namedParameters - **camera**: `Camera` - **input**: `Input` - **renderer**: `WebGLRenderer` - **simulatorOptions**: `SimulatorOptions` - **timer**: `Timer` ### Returns - `void` ``` -------------------------------- ### getMasterVolume() Source: https://xrblocks.github.io/docs/api/classes/CoreSound Gets the master volume level. ```APIDOC ## getMasterVolume() ### Description Gets the master volume level. ### Returns `number` ``` -------------------------------- ### init Source: https://xrblocks.github.io/docs/api/classes/User Initializes the User. ```APIDOC ## init() ### Description Initializes the User. ### Method POST (assumed, based on initialization) ### Endpoint /user/init ### Parameters #### Request Body - **input** (Input) - Required - **scene** (Scene) - Required ### Response #### Success Response (200) - **void** - Initialization successful. ``` -------------------------------- ### onObjectGrabStart Source: https://xrblocks.github.io/docs/api/classes/PagerState Called when the controller starts grabbing this object. ```APIDOC ## onObjectGrabStart(_event) ### Description Called when the controller starts grabbing this object. ### Parameters #### Path Parameters * **_event** (ObjectGrabEvent) - Description: None ### Returns `void` ``` -------------------------------- ### onSelectStart Source: https://xrblocks.github.io/docs/api/classes/User Handles the select start event for a controller. This method is called when a controller begins selecting an object. ```APIDOC ## onSelectStart(event) ### Description Handles the select start event for a controller. ### Parameters #### event - **event** (`SelectEvent`) - The event object. ### Returns - `void` ``` -------------------------------- ### onObjectSelectStart() Source: https://xrblocks.github.io/docs/api/classes/Col Called when the controller starts selecting this object the script represents. This handler initiates selection interactions. ```APIDOC ## onObjectSelectStart(_event) ### Description Called when the controller starts selecting this object the script represents, e.g. View, ModelView. ### Parameters #### _event - **_event** (SelectEvent) - event.target holds its controller. ### Returns - **boolean | void** - Whether the event was handled. If true, the event will not bubble up. ``` -------------------------------- ### onSimulatorStarted Source: https://xrblocks.github.io/docs/api/classes/ExitButton Called when the simulator starts. Inherited from IconButton. ```APIDOC ## onSimulatorStarted() ### Description Called when the simulator starts. ### Returns `void` ### Inherited from `IconButton`.`onSimulatorStarted` ``` -------------------------------- ### SimulatorMediaDeviceInfo Constructor Source: https://xrblocks.github.io/docs/api/classes/SimulatorMediaDeviceInfo Initializes a new instance of the SimulatorMediaDeviceInfo class. ```APIDOC ## Constructor > **new SimulatorMediaDeviceInfo**(`deviceId`, `groupId`, `kind`, `label`): `SimulatorMediaDeviceInfo` #### Parameters ##### deviceId `string` = `'simulator'` ##### groupId `string` = `'simulator'` ##### kind `MediaDeviceKind` = `'videoinput'` ##### label `string` = `'Simulator Camera'` #### Returns `SimulatorMediaDeviceInfo` ``` -------------------------------- ### init Source: https://xrblocks.github.io/docs/api/classes/Lighting Initializes the lighting module with the given options. This method sets up lights and shadows and adds necessary components to the scene. ```APIDOC ## init(lightingOptions, renderer, scene, depth?) ### Description Initializes the lighting module with the given options. Sets up lights and shadows and adds necessary components to the scene. ### Parameters #### lightingOptions - `LightingOptions` - Lighting options. #### renderer - `WebGLRenderer` - Main renderer. #### scene - `Scene` - Main scene. #### depth? - `Depth` - Depth manager. ### Returns `void` ``` -------------------------------- ### defaultOnSqueezeStart Source: https://xrblocks.github.io/docs/api/classes/Input Default handler for when a squeeze action starts. ```APIDOC ## defaultOnSqueezeStart() ### Description Default handler for when a squeeze action starts. ### Method `defaultOnSqueezeStart(event: ControllerEvent): void` ### Parameters #### event - **event** (ControllerEvent) - Description not provided. ``` -------------------------------- ### getCurrentDeviceIndex Source: https://xrblocks.github.io/docs/api/classes/XRDeviceCamera Gets the index of the currently active device. ```APIDOC ## getCurrentDeviceIndex() > **getCurrentDeviceIndex**(): `number` Gets the index of the currently active device. #### Returns `number` ``` -------------------------------- ### Constructor Source: https://xrblocks.github.io/docs/api/classes/SimulatorInterface Initializes a new instance of the SimulatorInterface. ```APIDOC ## new SimulatorInterface() ### Description Initializes a new instance of the SimulatorInterface. ### Returns `SimulatorInterface` - A new instance of the SimulatorInterface. ``` -------------------------------- ### Constructor Source: https://xrblocks.github.io/docs/api/classes/Registry Initializes a new instance of the Registry. ```APIDOC ## new Registry() ### Description Initializes a new instance of the Registry. ### Returns `Registry` - A new Registry instance. ``` -------------------------------- ### getAvailableDevices Source: https://xrblocks.github.io/docs/api/classes/XRDeviceCamera Gets the list of enumerated video devices. ```APIDOC ## getAvailableDevices() > **getAvailableDevices**(): `MediaOrSimulatorMediaDeviceInfo`[] Gets the list of enumerated video devices. #### Returns `MediaOrSimulatorMediaDeviceInfo`[] ``` -------------------------------- ### get() Source: https://xrblocks.github.io/docs/api/classes/Registry Retrieves an existing instance of a registered type. ```APIDOC ## get(type: Constructor): undefined | T ### Description Gets an existing instance of a registered type. ### Type Parameters * **T** `T` extends `object` ### Parameters * **type** (Constructor) - Required - The constructor function of the type to retrieve. ### Returns `undefined | T` - The instance of the requested type, or undefined if not found. ``` -------------------------------- ### init Source: https://xrblocks.github.io/docs/api/classes/SimulatorInterface Initializes the simulator interface with provided options and controls. ```APIDOC ## init(simulatorOptions, simulatorControls, simulatorHands) ### Description Initialize the simulator interface. ### Parameters #### simulatorOptions - `SimulatorOptions` - Options for the simulator. #### simulatorControls - `SimulatorControls` - Controls for the simulator. #### simulatorHands - `SimulatorHands` - Hand data for the simulator. ### Returns `void` ``` -------------------------------- ### timestep Source: https://xrblocks.github.io/docs/api/classes/Physics Gets the current timestep of the physics simulation. ```APIDOC ## timestep ### Description Gets the current timestep of the physics simulation. ### Get Signature `get timestep(): number` ### Returns `number` - The current physics timestep. ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/SimulatorHands Initializes the Simulator Hands with the provided input. ```APIDOC ## init(__namedParameters: { input: Input }) ### Description Initialize Simulator Hands. ### Parameters #### __namedParameters ##### input - `Input` - The input object to use for hand initialization. ### Returns - `void` ``` -------------------------------- ### Method: init Source: https://xrblocks.github.io/docs/api/classes/BackgroundMusic Initializes the script instance with XR controllers, grips, hands, raycaster, and default options. It provides access to user, world, and scene information. If this method returns a promise, the system will wait for it to resolve. ```APIDOC ## Method: init ### Description Initializes an instance with XR controllers, grips, hands, raycaster, and default options. We allow all scripts to quickly access its user (e.g., user.isSelecting(), user.hands), world (e.g., physical depth mesh, lighting estimation, and recognized objects), and scene (the root of three.js's scene graph). If this returns a promise, we will wait for it. ### Signature > **init**(`_?`): `void` | `Promise`<`void`> ### Parameters #### _? - `object` ### Returns - `void` | `Promise`<`void`> ``` -------------------------------- ### getAccumulatedChunkCount() Source: https://xrblocks.github.io/docs/api/classes/AudioListener Gets the number of accumulated audio chunks. ```APIDOC ## getAccumulatedChunkCount() > **getAccumulatedChunkCount**(): `number` ### Description Gets the number of accumulated chunks ### Returns `number` ``` -------------------------------- ### Constructor Source: https://xrblocks.github.io/docs/api/classes/CoreSound Initializes a new instance of the CoreSound class. ```APIDOC ## new CoreSound() ### Description Creates a new CoreSound object. ### Returns `CoreSound` ``` -------------------------------- ### onSimulatorStarted Source: https://xrblocks.github.io/docs/api/classes/VerticalPager Hook called when the simulator starts. Inherited from Pager. ```APIDOC ## onSimulatorStarted() ### Description Hook called when the simulator starts. ### Returns - `void` ### Inherited from `Pager`.`onSimulatorStarted` ``` -------------------------------- ### fadeOut Source: https://xrblocks.github.io/docs/api/classes/SpatialPanel Starts fading the panel and its children out. Inherited from Panel. ```APIDOC ## fadeOut() ### Description Starts fading the panel and its children out. ### Method `fadeOut`(`duration?`, `onComplete?`): `void` ### Parameters #### duration? `number` - Optional fade duration in seconds. #### onComplete? () => `void` - Optional callback when fade completes. ### Returns `void` ### Inherited from `Panel`.`fadeOut` ``` -------------------------------- ### setupRaycastCylinder() Source: https://xrblocks.github.io/docs/api/classes/ModelViewer Sets up a raycast cylinder for interaction. ```APIDOC ## setupRaycastCylinder() ### Description Sets up a raycast cylinder for interaction. ### Method `setupRaycastCylinder()` ### Returns `void` ``` -------------------------------- ### fadeIn Source: https://xrblocks.github.io/docs/api/classes/SpatialPanel Starts fading the panel and its children in. Inherited from Panel. ```APIDOC ## fadeIn() ### Description Starts fading the panel and its children in. ### Method `fadeIn`(`duration?`, `onComplete?`): `void` ### Parameters #### duration? `number` - Optional fade duration in seconds. #### onComplete? () => `void` - Optional callback when fade completes. ### Returns `void` ### Inherited from `Panel`.`fadeIn` ``` -------------------------------- ### Constructor Source: https://xrblocks.github.io/docs/api/classes/WorldOptions Initializes a new instance of WorldOptions with optional configuration. ```APIDOC ## Constructor new WorldOptions ### Description Initializes a new instance of WorldOptions with optional configuration. ### Parameters #### options - **debugging** (boolean) - Optional - Default: `false` - **enabled** (boolean) - Optional - Default: `false` - **initiateRoomCapture** (boolean) - Optional - Default: `false` - **meshes** (object) - Optional - **enable** (() => MeshDetectionOptions) - Optional - **enabled** (boolean) - Optional - Default: `false` - **showDebugVisualizations** (boolean) - Optional - Default: `false` - **objects** (object) - Optional - **backendConfig** (object) - Optional - **activeBackend** ('gemini' | 'mediapipe') - Optional - **gemini** (object) - Optional - **responseSchema** (object) - Optional - **items** (... | ...) - Optional - **type** (... | 'ARRAY') - Optional - **systemInstruction** (string) - Optional - **mediapipe** (object) - Optional - **modelAssetPath** (string) - Optional - Default: `'https://storage.googleapis.com/mediapipe-models/object_detector/efficientdet_lite2/int8/latest/efficientdet_lite2.tflite'` - **scoreThreshold** (number) - Optional - Default: `0.5` - **wasmFilesUrl** (string) - Optional - Default: `'https://cdn.jsdelivr.net/npm/@mediapipe/tasks-vision@0.10.34/wasm'` - **debugging** (boolean) - Optional - Default: `false` - **enable** (() => ObjectsOptions) - Optional - **enabled** (boolean) - Optional - Default: `false` - **objectImageMargin** (number) - Optional - Default: `0.05` - **showDebugVisualizations** (boolean) - Optional - Default: `false` - **planes** (object) - Optional - **debugging** (boolean) - Optional - Default: `false` - **enable** (() => PlanesOptions) - Optional - **enabled** (boolean) - Optional - Default: `false` - **showDebugVisualizations** (boolean) - Optional - Default: `false` ### Returns `WorldOptions` ``` -------------------------------- ### onSimulatorStarted Source: https://xrblocks.github.io/docs/api/classes/Row Hook called when the simulator starts. Inherited from Grid. ```APIDOC ## onSimulatorStarted ### Description Hook called when the simulator starts. ### Returns `void` ### Inherited from `Grid`.`onSimulatorStarted` ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/SketchPanel Initializes the SketchPanel. ```APIDOC ## init(__namedParameters) ### Description Init the SketchPanel. ### Parameters #### __namedParameters ##### user - `User`: The user object associated with the initialization. ### Returns - `void` ``` -------------------------------- ### Serve XR Blocks Samples and Demos Source: https://xrblocks.github.io/docs/api This command serves the XR Blocks repository, allowing you to view samples and demos locally via http://localhost:8080/. It's useful for previewing the library's capabilities. ```bash # Serve the repository on http://localhost:8080 npm run serve ``` -------------------------------- ### onHoverEnter Source: https://xrblocks.github.io/docs/api/classes/Pager Called when the controller starts hovering over this object with reticle. ```APIDOC ## onHoverEnter ### Description Called when the controller starts hovering over this object with reticle. ### Method POST ### Endpoint /onHoverEnter ### Parameters #### Request Body - **_controller** (Object3D) - Required - An XR controller. ### Returns `boolean` | `void` - Whether the event was handled. If true, the event will not bubble up. ``` -------------------------------- ### Basic XR Scene with XR Blocks Source: https://xrblocks.github.io/docs/api This example demonstrates how to set up a basic XR scene with a cylinder that changes color on pinch or click. It requires importing XR Blocks via an importmap and initializing the XR Blocks library. ```html Basic Example | XR Blocks ``` -------------------------------- ### onXRSessionStarted(_session?) Source: https://xrblocks.github.io/docs/api/classes/MaterialSymbolsView Hook called when an XR session starts. ```APIDOC ## onXRSessionStarted(_session?) ### Description Hook called when an XR session starts. ### Parameters #### _session? - `_session?` (`XRSession`) ### Returns `void` ### Inherited from `View`.`onXRSessionStarted` ``` -------------------------------- ### init Source: https://xrblocks.github.io/docs/api/classes/SimulatorScene Initializes the simulator scene with provided options. This is an asynchronous operation. ```APIDOC ## init(simulatorOptions) ### Description Initializes the simulator scene with the given simulation options. This method is asynchronous and returns a Promise. ### Parameters #### simulatorOptions - **simulatorOptions** (`SimulatorOptions`) - An object containing options for the simulator. ### Returns `Promise` - A promise that resolves when the initialization is complete. ``` -------------------------------- ### onHoverEnter() Source: https://xrblocks.github.io/docs/api/classes/AudioListener Called when the controller starts hovering over this object with a reticle. ```APIDOC ## onHoverEnter() > **onHoverEnter**(`_controller`): `boolean` | `void` ### Description Called when the controller starts hovering over this object with reticle. ### Parameters #### _controller `Object3D` An XR controller. ### Returns `boolean` | `void` Whether the event was handled. If true, the event will not bubble up. ### Inherited from `Script`.`onHoverEnter` ``` -------------------------------- ### onSqueezeStart Source: https://xrblocks.github.io/docs/api/classes/DepthMesh Called whenever gamepad trigger starts, globally. ```APIDOC ## onSqueezeStart() ### Description Called whenever gamepad trigger starts, globally. ### Parameters #### _event - `SelectEvent` event.target holds its controller. ### Returns - `void` ### Inherited from `MeshScript`.`onSqueezeStart` ``` -------------------------------- ### init() Method Source: https://xrblocks.github.io/docs/api/classes/SimulatorUserAction Initializes the action with provided options. This method is part of the Injectable interface. ```APIDOC ## init() > **init**(`_options`): `Promise`<`void`> #### Parameters ##### _options `object` = `{}` #### Returns `Promise`<`void`> #### Implementation of `Injectable`.`init` ``` -------------------------------- ### onSqueezeStart Source: https://xrblocks.github.io/docs/api/classes/AudioPlayer Called whenever gamepad trigger starts, globally. ```APIDOC ## onSqueezeStart ### Description Called whenever gamepad trigger starts, globally. ### Method `onSqueezeStart(_event: SelectEvent): void` ### Parameters #### _event - `SelectEvent`: event.target holds its controller. ### Returns - `void` ### Inherited from `Script`.`onSqueezeStart` ``` -------------------------------- ### getCurrentTrackSettings Source: https://xrblocks.github.io/docs/api/classes/XRDeviceCamera Gets the settings of the currently active video track. ```APIDOC ## getCurrentTrackSettings() > **getCurrentTrackSettings**(): `undefined` | `MediaTrackSettings` Gets the settings of the currently active video track. #### Returns `undefined` | `MediaTrackSettings` ``` -------------------------------- ### showInstructions Source: https://xrblocks.github.io/docs/api/classes/SimulatorInterface Displays the instructions panel. ```APIDOC ## showInstructions(simulatorOptions) ### Description Displays the instructions panel. ### Parameters #### simulatorOptions - `SimulatorOptions` - Options for the simulator. ### Returns `void` ``` -------------------------------- ### getCurrentDevice Source: https://xrblocks.github.io/docs/api/classes/XRDeviceCamera Gets the currently active device info, if available. ```APIDOC ## getCurrentDevice() > **getCurrentDevice**(): `undefined` | `MediaOrSimulatorMediaDeviceInfo` Gets the currently active device info, if available. #### Returns `undefined` | `MediaOrSimulatorMediaDeviceInfo` ``` -------------------------------- ### Constructor Source: https://xrblocks.github.io/docs/api/classes/SimulatorScene Initializes a new instance of the SimulatorScene. ```APIDOC ## new SimulatorScene() ### Description Initializes a new instance of the SimulatorScene. ### Returns `SimulatorScene` - A new instance of SimulatorScene. ### Overrides `THREE.Scene.constructor` ``` -------------------------------- ### Build SDK in Watch Mode Source: https://xrblocks.github.io/docs/api Run this command to build the SDK in watch mode and serve the repository locally. This is useful for development and testing. ```bash npm run dev ``` -------------------------------- ### getReticleTarget Source: https://xrblocks.github.io/docs/api/classes/User Gets the object targeted by the reticle. Requires `options.reticle.enabled`. ```APIDOC ## getReticleTarget() ### Description Gets the object targeted by the reticle. Requires `options.reticle.enabled`. ### Method GET (assumed, based on naming convention) ### Endpoint /user/reticle/target/{id} ### Parameters #### Path Parameters - **id** (number) - Required - The controller id. ### Response #### Success Response (200) - **target** (Object3D) - The targeted object, or null. - **undefined** - If reticle is not enabled or controller id is invalid. ``` -------------------------------- ### Method: init() Source: https://xrblocks.github.io/docs/api/classes/World Initializes the world-sensing modules based on the provided configuration. This method is called automatically by the XRCore. ```APIDOC ## Methods ### init() > **init**(`__namedParameters`): `Promise`<`void`> #### Parameters ##### __namedParameters ###### camera `Camera` ###### options `WorldOptions` #### Returns `Promise`<`void`> ``` -------------------------------- ### getPivot Source: https://xrblocks.github.io/docs/api/classes/User Gets the pivot object for a given controller id. ```APIDOC ## getPivot() ### Description Gets the pivot object for a given controller id. ### Method User.getPivot ### Parameters #### id - **id** (number) - Required - The controller id. ### Returns `undefined | Object3D` - The pivot object, or undefined if not found. ``` -------------------------------- ### formFactor (Getter) Source: https://xrblocks.github.io/docs/api/classes/Options Gets the current form factor of the experience. ```APIDOC ## get formFactor() ### Description Gets the current form factor of the experience. ### Returns `"auto"` | `"xr"` | `"hud"` | `"vr"` | `"desktop"` | `"mobile"` - The current form factor. ``` -------------------------------- ### init() Method Source: https://xrblocks.github.io/docs/api/interfaces/Injectable Initializes the injectable instance with provided arguments. ```APIDOC ## init(...args: unknown[]): void | Promise ### Description Initializes the injectable instance with provided arguments. This method can be synchronous or asynchronous. ### Parameters * **args** (...unknown[]) - A variable number of arguments to pass during initialization. ### Returns * `void` | `Promise` - Returns nothing synchronously or a Promise that resolves to nothing. ``` -------------------------------- ### getRecordingSampleRate() Source: https://xrblocks.github.io/docs/api/classes/CoreSound Gets the sample rate currently being used for recording. ```APIDOC ## getRecordingSampleRate() ### Description Gets the sample rate being used for recording. ### Returns `number` ``` -------------------------------- ### getCategoryVolume(category) Source: https://xrblocks.github.io/docs/api/classes/CoreSound Gets the volume for a specific audio category. ```APIDOC ## getCategoryVolume(category) ### Description Gets the volume for a specific audio category. ### Parameters #### category - `category` (VolumeCategory) ### Returns `number` ``` -------------------------------- ### onSelectStart Source: https://xrblocks.github.io/docs/api/classes/VideoFileStream Callback function executed when a pinch or mouse click action begins globally. It is inherited from the VideoStream class. ```APIDOC ## onSelectStart() ### Description Called whenever pinch / mouse click starts, globally. ### Method `onSelectStart(_event: SelectEvent): void` ### Parameters #### _event - `SelectEvent` - event.target holds its controller ### Returns - `void` ### Inherited from `VideoStream`.`onSelectStart` ``` -------------------------------- ### GetWeatherTool Source: https://xrblocks.github.io/docs/api/classes/GetWeatherTool A tool that gets the current weather for a specific location. ```APIDOC ## Class: GetWeatherTool ### Description A tool that gets the current weather for a specific location. ### Constructor ```typescript new GetWeatherTool(): GetWeatherTool ``` ### Methods #### execute ```typescript execute(args: GetWeatherArgs): Promise> ``` ##### Parameters * `args` (GetWeatherArgs) - Required - The arguments for the tool. ##### Returns `Promise>` - A promise that resolves with a ToolResult containing weather information. #### toJSON ```typescript toJSON(): FunctionDeclaration ``` ##### Returns `FunctionDeclaration` - A valid FunctionDeclaration object. ``` -------------------------------- ### Initialize XR with Transitions Source: https://xrblocks.github.io/docs/templates/XR-Toggle Sets up the XR environment and enables XR transitions. This should be called early in your application's lifecycle. ```javascript document.addEventListener('DOMContentLoaded', function () { const options = new xb.Options().enableXRTransitions(); xb.add(new MainScript()); xb.init(options); }); ``` -------------------------------- ### init Source: https://xrblocks.github.io/docs/api/classes/Physics Asynchronously initializes the RAPIER physics engine and creates the blendedWorld. ```APIDOC ## init(physicsOptions) ### Description Asynchronously initializes the RAPIER physics engine and creates the blendedWorld. This is called in Core before the physics simulation starts. ### Parameters #### __namedParameters - **physicsOptions** (PhysicsOptions) - Required - Options for initializing the physics engine. ### Returns `Promise` - A promise that resolves when the physics engine is initialized. ``` -------------------------------- ### onObjectSelectStart Source: https://xrblocks.github.io/docs/api/classes/ExitButton Called when the controller starts selecting this object. Inherited from IconButton. ```APIDOC ## onObjectSelectStart( _event ): boolean | void ### Description Called when the controller starts selecting this object the script represents, e.g. View, ModelView. ### Parameters #### _event - **_event** (SelectEvent) - event.target holds its controller. ### Returns `boolean` | `void` - Whether the event was handled. If true, the event will not bubble up. ### Inherited from `IconButton`.`onObjectSelectStart` ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/ImageView Initializes the component. Called once by the XR Blocks lifecycle. ```APIDOC ## init() ### Description Initializes the component. Called once by the XR Blocks lifecycle. ### Method N/A (Method call) ### Returns `void` ``` -------------------------------- ### onHoverEnter(_controller) Source: https://xrblocks.github.io/docs/api/classes/CoreSound Called when the controller starts hovering over this object with a reticle. ```APIDOC ## onHoverEnter(_controller) ### Description Called when the controller starts hovering over this object with reticle. ### Parameters #### _controller - **_controller** (Object3D) - Required - An XR controller. ### Returns `boolean` | `void` Whether the event was handled. If true, the event will not bubble up. ``` -------------------------------- ### Initialize XR Blocks Core Source: https://xrblocks.github.io/docs/manual/Core Call `xb.init()` with an `Options` object to set up the XR Blocks Core. Ensure all necessary imports are included. ```typescript import * as xb from 'xrblocks'; const options = new xb.Options(); xb.init(options); ``` -------------------------------- ### init() Source: https://xrblocks.github.io/docs/api/classes/Gemini Initializes the AI model. ```APIDOC ## init() > **init**(): `Promise`<`void`> #### Returns `Promise`<`void`> ``` -------------------------------- ### onObjectSelectStart Source: https://xrblocks.github.io/docs/api/classes/DepthMesh Called when the controller starts selecting this object the script represents. ```APIDOC ## onObjectSelectStart() ### Description Called when the controller starts selecting this object the script represents, e.g. View, ModelView. ### Parameters #### _event - `SelectEvent` event.target holds its controller. ### Returns - `boolean` | `void` Whether the event was handled. If true, the event will not bubble up. ### Inherited from `MeshScript`.`onObjectSelectStart` ``` -------------------------------- ### Initialize XRBlocks UI Source: https://xrblocks.github.io/docs/templates/UI Sets up the XRBlocks environment and enables UI features. This script should be run on DOMContentLoaded. ```javascript import 'xrblocks/addons/simulator/SimulatorAddons.js'; import * as xb from 'xrblocks'; import {UIManager} from './UIManager.js'; const options = new xb.Options(); options.enableUI(); document.addEventListener('DOMContentLoaded', function () { xb.add(new UIManager()); xb.init(options); }); ``` -------------------------------- ### Method: init Source: https://xrblocks.github.io/docs/api/classes/SimulatorDepth Initializes the Simulator Depth system with the provided renderer, camera, and depth configuration. ```APIDOC ## Method: init() ### Description Initialize Simulator Depth. ### Parameters #### renderer - **renderer** (`WebGLRenderer`) - The WebGL renderer instance. #### camera - **camera** (`Camera`) - The camera instance. #### depth - **depth** (`Depth`) - The depth configuration object. ### Returns `void` ``` -------------------------------- ### onObjectGrabStart Source: https://xrblocks.github.io/docs/api/classes/DepthMesh Called when a hand starts grabbing this object (touching + pinching). ```APIDOC ## onObjectGrabStart() ### Description Called when a hand starts grabbing this object (touching + pinching). ### Parameters #### _event - `ObjectGrabEvent` ### Returns - `void` ### Inherited from `MeshScript`.`onObjectGrabStart` ``` -------------------------------- ### getPivotPosition Source: https://xrblocks.github.io/docs/api/classes/User Gets the world position of the pivot for a given controller id. ```APIDOC ## getPivotPosition() ### Description Gets the world position of the pivot for a given controller id. ### Method GET (assumed, based on naming convention) ### Endpoint /user/pivot-position/{id} ### Parameters #### Path Parameters - **id** (number) - Required - The controller id. ### Response #### Success Response (200) - **position** (Vector3) - The world position of the pivot. - **undefined** - If the controller id is invalid or pivot is not available. ``` -------------------------------- ### getWidth Source: https://xrblocks.github.io/docs/api/classes/SpatialPanel Gets the panel's width in meters. Inherited from Panel. ```APIDOC ## getWidth() ### Description Gets the panel's width in meters. ### Method `getWidth`(): `number` ### Returns `number` - The width in meters. ### Inherited from `Panel`.`getWidth` ``` -------------------------------- ### Method: init() Source: https://xrblocks.github.io/docs/api/classes/SimulatorCamera Initializes the simulator camera. This method should be called before using other simulator camera functionalities. ```APIDOC ## init() ### Description Initializes the simulator camera. ### Returns - **void** - This method does not return any value. ``` -------------------------------- ### initializeAudioContext Source: https://xrblocks.github.io/docs/api/classes/AudioPlayer Initializes the audio context for the player. ```APIDOC ## initializeAudioContext() ### Description Initializes the audio context for the player. ### Returns * `Promise` ``` -------------------------------- ### getHeight Source: https://xrblocks.github.io/docs/api/classes/SpatialPanel Gets the panel's height in meters. Inherited from Panel. ```APIDOC ## getHeight() ### Description Gets the panel's height in meters. ### Method `getHeight`(): `number` ### Returns `number` - The height in meters. ### Inherited from `Panel`.`getHeight` ``` -------------------------------- ### iconColor Property Source: https://xrblocks.github.io/docs/api/classes/MaterialSymbolsView Gets the current color of the Material Symbol icon. ```APIDOC ## iconColor ### Description Gets the current color of the Material Symbol icon. ### Get Signature ```typescript get iconColor(): string ``` ``` -------------------------------- ### Initialize XR Blocks Scene Setup Source: https://xrblocks.github.io/docs Import XR Blocks into your JavaScript module and call `xb.init()` to initialize the XR Core. This sets up the renderer and scene, making `xb.scene` accessible for further manipulation. ```javascript import * as xb from 'xrblocks'; // Initialize the XR Core object to create a renderer and scene. xb.init(); // Now we can access the scene from `xb.scene`; // This is a standard THREE.Scene object. xb.scene; ``` -------------------------------- ### Method: getWrist() Source: https://xrblocks.github.io/docs/api/classes/Hands Gets the wrist joint for a specified or dominant hand. ```APIDOC ## Method: getWrist() ### Description Gets the wrist joint for a specified or dominant hand. ### Parameters #### handedness - **handedness** (Handedness) - Optional - Defaults to Handedness.NONE (uses dominant hand). ### Returns - `undefined` | `XRJointSpace` - The joint object or null. ```