Image BabylonAdapter
Import
js
import { BabylonAdapter } from 'monolook/image/babylon'Constructor
js
const adapter = new BabylonAdapter({
scene,
camera,
engine,
BABYLON,
showVideo: true,
container: document.body
})| Option | Type | Required | Default |
|---|---|---|---|
scene | BABYLON.Scene | Yes | - |
camera | BABYLON.Camera | Yes | - |
engine | BABYLON.Engine | Yes | - |
BABYLON | object | If not global | window.BABYLON |
showVideo | boolean | No | true |
container | HTMLElement | No | document.body |
Methods
| Method | Returns | Description |
|---|---|---|
attach(tracker) | void | Connects to MonolookImage |
detach() | void | Removes listeners |
addARContent(targetId, mesh, options?) | void | Maps mesh to target |
removeARContent(targetId) | void | Removes AR content |
setupVideoBackground() | void | Creates video background |
setup() | void | Configures background and camera after tracker.start() |
startRenderLoop() | void | Starts internal loop |
stopRenderLoop() | void | Stops internal loop |
destroy() | void | Cleanup |
Notes
| Point | Value |
|---|---|
| Camera | FreeCamera at (0, 0, 0) looking at (0, 0, 1) |
| Render loop | Can be managed by the adapter with startRenderLoop() |