Wikitude ARchitect v2.0 API Documentation

Wikitude ARchitect > AR > Tracker
Filters

Class Tracker - extends ARchitectObject

A Tracker represents a patternset which is created with the Vuforia SDK.

A Tracker needs to include the binary targets and the xml file describing the targets. The Tracker data needs to be zipped into one file, and the file needs to be referenced via a URI. The system will search for the dat and the xml file in the zip file, regardless of their names. To avoid conflicts, a developer needs to make sure only one .xml and only one .dat file is present in the zip file.

The Tracker object is used to reference specific Trackable2DObjects (the targets inside the patternset).

Trackers can be enabled and disabled. Due to the nature of the Vuforia SDK, only one Tracker can be active at a time. The current enabled/disabled state of a Tracker is reflected in the enabled property. Should there be multiple Trackers used in the ARchitect file, the following logic applies to specify the currently active Tracker:
  • When a new Tracker is created, it is automatically set to the active one, unless it was created with enabled set to false.
  • When a specific Tracker is enabled, it is automatically set to the active one. The previously active Tracker is disabled by the system.
In case a Tracker is disabled by the system, the developer will be notified via the onDisabled trigger.

Example:
// a Tracker referencing a patternset on a server
var tracker1 = new AR.Tracker("http://myserver.com/patternset1.zip", {
  onDisabled : function(){
    //tracker has been disabled by the system
  }
});
var enabled = tracker1.enabled; //true

// a second tracker, which will cause tracker1 to be disabled var tracker2 = new AR.Tracker("http://myserver.com/patternset2.zip");
enabled = tracker1.enabled; //false enabled = tracker2.enabled; //true

Constructor

Tracker ( src , options )
Parameters:
src <String> The URI to the zipped pattern set
options <object> Setup-Parameters to customize additional object properties.

Accepted options-properties are
  • enabled
  • onDisabled
  • onLoaded
  • onError

Properties

enabled - boolean

The current activity state of the Tracker. This property might by changed automatically by the system, in case another Tracker is enabled, causing this Tracker to be disabled. The onDisabled trigger will be called in this case.

src - String

The URI pointing to the referenced zipped patternset. The property is read-only and can only be set on creation.

Properties inherited from ARchitectObject:

Methods

isLoaded

boolean isLoaded ( )
Returns a boolean value indicating if the tracker has already been successfully loaded.
Returns: boolean
  • true if the Tracker has successfully loaded.
  • false if the Tracker has not been successfully loaded yet.

onDisabled

void onDisabled ( )
The trigger fires when the Tracker has been disabled by the system. It does not fire when enabled is set to false manually.

The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onDisabled.
Returns: void

onError

void onError ( )
The trigger fires when the Tracker's patternset could not be loaded. Causes for this might include bad network connection or a corrupt patternset.

The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onError.
Returns: void

onLoaded

void onLoaded ( )
The trigger fires when the Tracker's patternset was successfully loaded. TrackableObjects related to this Tracker can only be tracked after the Tracker was successfully loaded.

The trigger is null by default, and will thus result in no action executed when the trigger fires. A developer can add custom functionality by assigning a custom function to onLoaded.
Returns: void

Methods inherited from ARchitectObject:


Copyright © 2013 Wikitude GmbH. All rights reserved.