- Docs
- Build with the SDK
Use it with A-Frame (plain HTML)
Three script tags and a scene. No bundler, no install. With npm, npm install @tempusxr/sdk-aframe @tempusxr/sdk-tracker-image aframe.
<script src="https://aframe.io/releases/1.8.0/aframe.min.js"></script>
<script src="https://tempusxr.vercel.app/v1/tempusxr-aframe.min.js"></script>
<script src="https://tempusxr.vercel.app/v1/tempusxr-image.min.js"></script>
<a-scene tempusxr="tracker: image; targets: targets.txr; maxTrack: 2" renderer="alpha: true" vr-mode-ui="enabled: false">
<a-camera look-controls="enabled: false" wasd-controls="enabled: false"></a-camera>
<a-entity tempusxr-image-target="index: 0">
<a-plane width="1" height="0.75" color="#40c4ff" opacity="0.3"></a-plane>
<a-box position="0 0 0.15" width="0.3" height="0.3" depth="0.3" color="red"></a-box>
</a-entity>
</a-scene>
Load order matters: A-Frame, then Tempusxr, then the tracker. The Tempusxr file also holds the scene file loader (tempusxr-scene) and photo and video capture (tempusxr-capture).
tempusxr on the scene
| Attribute | Default | Meaning |
|---|---|---|
tracker | image | Which tracker to use. |
targets | none | One or several .txr files, separated by commas. |
maxTrack | 1 | Images followed at the same time. |
warmupTolerance, missTolerance | 5, 5 | Frames before an image counts as found, and before it counts as lost. |
smoothing | true | Smooth the pose. filterMinCutOff (1.5) and filterBeta (8) tune it. |
facing | environment | Rear camera. Use the rear camera for tracking. |
cameraWidth, cameraHeight | 640, 480 | Camera image size. Smaller is faster (see section 7). |
autoStart | true | With false, start by hand: scene.components.tempusxr.start(). |
overlay | default | default, none, or a selector of your own overlay. |
language | browser | fr or en. |
debug | false | Show the debug panel (see section 8). Also on with ?debug in the address. |
tempusxr-image-target="index: N" puts an entity on the Nth image of the .txr files. The entity is shown only while that image is seen. Content sees the image as a plane 1 unit wide (or the printed width in meters if the file has one), centered, +X right, +Y up, +Z toward the viewer.
tempusxr-image-plane on an <a-plane> (or <a-video>) inside a target gives it the real size and proportions of the image, whatever they are: <a-plane tempusxr-image-plane color="red"></a-plane>.
Events. On the entity: targetFound, targetLost. On the scene: tempusxr-ready (detail: tracker, overlay), tempusxr-error (detail: error).
document.querySelector('[tempusxr-image-target]').addEventListener('targetFound', () => {
console.log('seen!');
});