Wikitude ARchitect v2.0 API Documentation

Wikitude ARchitect > AR > Trackable2DObject
Filters

Class Trackable2DObject - extends ARObject

A Trackable2DObject represents a virtual object bound to a specific target in a patternset. The target will be tracked in the camera scene, and Drawables will be projected onto the target as soon as it becomes visible and is detected in the scene. Any Trackable2DObject is linked to one target in a specific patternset.

A Trackable2DObject
  • is associated with one Tracker and a specific target inside the Tracker.
  • can have Drawables associated with it. These Drawables will represent the Trackable2DObject in the camera view.
  • can have triggers associated with it. Triggers fire on certain events and execute functions to react on these actions.
On creation, a reference to the Tracker, as well as the name of the target in the Tracker must be passed.

A Trackable2DObject can either be enabled or disabled (see ARObject.enabled). Enabled means that the Trackable2DObject will be considered in the tracking of objects in the camera, and its triggers will fire on the appropriate events. In case the Trackable2DObject is disabled, it will not be considered in the tracking process, and it will not fire any triggers. Note that the associated Tracker must also be enabled for the Trackable2DObject to be considered for tracking.

On creation, setup parameters can be passed to customize the properties of the Trackable2DObject.

Example:
// a circle used for representation
var circle = new AR.Circle(5);
// the referenced tracker
var tracker = new AR.Tracker("http://myserver.com/patternset1.zip");
// a Trackable2DObject using the "car" target in the tracker, using the circle as the digital representation.
var trackable2DObject = new AR.Trackable2DObject(tracker, "car", {
  drawables : { cam : circle }
});
For the render size of attached Drawables, see the chapter on SDUs.

Constructor

Trackable2DObject ( tracker , targetName , options )
Parameters:
tracker <Tracker> The Tracker the target is stored in
targetName <string> The name of the target in the Tracker
options <object> Setup-Parameters to customize additional object properties.

Accepted options-properties are
  • enabled
  • renderingOrder
  • onEnterFieldOfVision
  • onExitFieldOfVision
  • onClick
  • drawables.cam

Properties

height - float

The actual real-world height of the target, in meters. The value is derived from the specified target, it needs to be set when the target is created with the Vuforia SDK. This property is read-only and will be generated after the target was loaded. The property will be undefined if the referenced Tracker was not yet loaded.

targetName - String

The name of the referenced target inside the pattern set. This property is read-only and can only be set on creation.

tracker - Tracker

The Tracker which contains the target referenced by this Trackable2DObject. This property is read-only and can only be set on creation.

width - float

The actual real-world width of the target, in meters. The value is derived from the specified target, it needs to be set when the target is created with the Vuforia SDK. This property is read-only and will be generated after the target was loaded. The property will be undefined if the referenced Tracker was not yet loaded.

Properties inherited from ARObject:

Properties inherited from ARchitectObject:

Methods

getDistance

float getDistance ( )
Returns the distance from the viewport to the center of gravity of the tracked Trackable2DObject, in meters. The method will return undefined if the Trackable2DObject is not currently in the field of vision.
Returns: float
The numeric distance in meters.


Copyright © 2013 Wikitude GmbH. All rights reserved.