Monolook World API
Import
js
import { Monolook } from 'monolook/world'Constructor
js
const monolook = new Monolook({
adapter: 'three',
THREE,
scene,
camera,
renderer,
domOverlayRoot
})Options
| Option | Type | Required | Description |
|---|---|---|---|
adapter | 'three' | 'aframe' | 'babylon' | Yes | Built-in adapter |
THREE | object | Three.js | Three.js namespace |
scene | object | Three/Babylon | Engine scene |
camera | object | Three/Babylon | Engine camera |
renderer | object | Three | Three.js renderer |
sceneEl | HTMLElement | A-Frame | Loaded <a-scene> |
engine | object | Babylon | Babylon.js engine |
BABYLON | object | Babylon | Babylon.js namespace |
domOverlayRoot | HTMLElement | No | Root for WebXR overlay UI |
Methods
| Method | Returns | Description |
|---|---|---|
start(options) | Promise<void> | Validates license and initializes SDK |
enterAR(options?) | Promise<XRSession | null> | Requests AR session |
startTracking() | void | Starts surface search |
pauseTracking() | void | Pauses tracking |
setRenderLoop(callback) | void | Sets render loop |
updateTracking() | void | Updates camera/indicator |
getIndicatorPose() | { position, rotation, visible } | null | Placement point pose |
setIndicatorVisible(visible) | void | Shows/hides indicator |
setTransparentBackground() | void | Transparent AR background |
setDesktopBackground(color?) | void | Preview background |
reset() | void | Resets state |
isPresenting() | boolean | Whether an AR session is active |
on(event, callback) | () => void | Subscribes to event |
off(event, callback) | void | Unsubscribes event |
start(options)
| Option | Type | Required | Description |
|---|---|---|---|
mode | 'surface' | Yes | Tracking mode |
licenseKey | string | Yes | World license key |
Events
| Event | Payload | Description |
|---|---|---|
surfacefound | { pose } | Surface detected |
surfacelost | object | Surface lost |
select | { nativeEvent } | Tap/select in AR |
sessionstart | { platform, ...payload } | Session started |
sessionend | { platform, ...payload } | Session ended |
trackingstart | undefined | Tracking active |
trackingpause | undefined | Tracking paused |
licensed | object | License validated |
error | Error | Error |