Wikitude ARchitect v3.2 API Documentation

Wikitude ARchitect > AR > Trackable2DObject
Filters

Class Trackable2DObject - extends ARObject

A Trackable2DObject represents a virtual object bound to a specific target in a target collection. 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 target collection.

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/targetCollection1.wtc");
// 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

aspectRatio - float

The aspect ratio of the target, defined as width/height. 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.

height - float

Deprecated: Use aspectRatio instead. The immutable property is undefined when the Trackable2DObject was not yet loaded, and set to 1 otherwise.

targetName - String

The name of the referenced target inside the target collection. 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

Deprecated: Use aspectRatio instead. Width behaves the same way as the property aspectRatio.

Properties inherited from ARObject:

Properties inherited from ARchitectObject:

Methods

getDistance

void getDistance ( )
Returns: void
Deprecated The functionality is not available anymore. When the function is called, it will always return 0.


Copyright © 2013 Wikitude GmbH. All rights reserved.