API Reference

Class List

pc.XrTrackedImage

The tracked image interface that is created by the Image Tracking system and is provided as a list from pc.XrImageTracking#images. It contains information about the tracking state as well as the position and rotation of the tracked image.

Summary

Properties

emulated

True if image was recently tracked but currently is not actively tracked due to inability of identifying the image by the underlying AR system.

image

Image that is used for tracking.

trackable

True if image is trackable.

tracking

True if image is in tracking state and being tracked in real world by the underlying AR system.

width

Width that is provided to assist tracking performance.

Methods

getPosition

Get the position of the tracked image.

getRotation

Get the rotation of the tracked image.

Events

tracked

Fired when image becomes actively tracked.

untracked

Fired when image is no more actively tracked.

Details

Constructor

XrTrackedImage(image, width)

The tracked image interface that is created by the Image Tracking system and is provided as a list from pc.XrImageTracking#images. It contains information about the tracking state as well as the position and rotation of the tracked image.

Parameters

imageHTMLCanvasElement, HTMLImageElement, SVGImageElement, HTMLVideoElement, Blob, ImageData, ImageBitmap

Image that is matching the real world image as closely as possible. Resolution of images should be at least 300x300. High resolution does NOT improve tracking performance. Color of image is irrelevant, so greyscale images can be used. Images with too many geometric features or repeating patterns will reduce tracking stability.

widthnumber

Width (in meters) of image in real world. Providing this value as close to the real value will improve tracking quality.

Properties

booleanemulated

True if image was recently tracked but currently is not actively tracked due to inability of identifying the image by the underlying AR system. Position and rotation will be based on the previously known transformation assuming the tracked image has not moved.

booleantrackable

True if image is trackable. A too small resolution or invalid images can be untrackable by the underlying AR system.

booleantracking

True if image is in tracking state and being tracked in real world by the underlying AR system.

numberwidth

Width that is provided to assist tracking performance. This property can be updated only when the AR session is not running.

Methods

getPosition()

Get the position of the tracked image. The position is the most recent one based on the tracked image state.

// update entity position to match tracked image position
entity.setPosition(trackedImage.getPosition());

Returns

pc.Vec3

Position in world space.

getRotation()

Get the rotation of the tracked image. The rotation is the most recent based on the tracked image state.

// update entity rotation to match tracked image rotation
entity.setRotation(trackedImage.getRotation());

Returns

pc.Quat

Rotation in world space.

Events

tracked

Fired when image becomes actively tracked.

untracked

Fired when image is no more actively tracked.