Skip to content

Installation

Install the monolook package and the 3D engine used by your integration.

bash
npm install monolook

For Three.js:

bash
npm install three

For Babylon.js:

bash
npm install @babylonjs/core

A-Frame is usually loaded from a CDN in the HTML.

Imports

Monolook uses sub-paths. Import only the product and adapter you need.

Sub-pathDescription
monolook/worldMonolook World facade for surface tracking.
monolook/world/threeThree.js adapter for World.
monolook/world/aframeA-Frame adapter for World.
monolook/world/babylonBabylon.js adapter for World.
monolook/imageMonolook Image core for image tracking.
monolook/image/threeThree.js adapter for Image.
monolook/image/aframeA-Frame adapter for Image.
monolook/image/babylonBabylon.js adapter for Image.

World

js
import * as THREE from 'three'
import { Monolook } from 'monolook/world'

const monolook = new Monolook({
  adapter: 'three',
  THREE,
  scene,
  camera,
  renderer,
  domOverlayRoot: document.getElementById('dom_overlay')
})

await monolook.start({
  mode: 'surface',
  licenseKey: '<WORLD_LICENSE_KEY>'
})

Image

js
import { MonolookImage } from 'monolook/image'
import { ThreeAdapter } from 'monolook/image/three'

const tracker = new MonolookImage({
  licenseKey: '<IMAGE_LICENSE_KEY>'
})

await tracker.init()

const adapter = new ThreeAdapter({ scene, camera, renderer })
adapter.attach(tracker)

Vite

If you use Monolook Image with Vite, exclude monolook from optimizeDeps so the WASM module resolves correctly in development.

js
import { defineConfig } from 'vite'

export default defineConfig({
  optimizeDeps: {
    exclude: ['monolook']
  }
})

Peer dependencies

three, aframe, and @babylonjs/core are optional peer dependencies. Install only the engine used by your project.