InstantTracker Class
An InstantTracker represents the instant tracking algorithm. It does not require any
pre-existing target information, but can immediately start tracking. Minimally it can
be instantiated without any parameters.
Trackers can be enabled and disabled. 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.
this.tracker = new AR.InstantTracker();
this.tracker = new AR.InstantTracker({ onChangedState: function onChangedStateFn(state) { // react to a change in tracking state here }, // device height needs to be as accurate as possible to have an accurate scale // returned by the Wikitude SDK deviceHeight: 1.0, // The initial orientation at which the instant tracking plane should be displayed in degrees. // Default value is AR.CONST.INITIAL_INSTANT_TRACKING_PLANE_ORIENTATION.HORIZONTAL (0°). trackingPlaneOrientation: 45.0 });
Constructor
InstantTracker
-
options
Parameters:
-
options
Object optionalSetup-Parameters to customize additional object properties.
Accepted options-properties are
Item Index
Methods
Properties
Events
Methods
destroy
()
Destroys the object.
Properties
deviceHeight
Number
The device height used in the scale estimation of the instant tracking algorithm in meters.
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.
state
Number
The current internal state of the Tracker. Can either be AR.InstantTrackerState.INITIALIZING or AR.InstantTrackerState.TRACKING.
trackingPlaneOrientation
Number
The initial orientation at which the instant tracking plane should be displayed in degrees.
Default values is AR.CONST.INITIAL_INSTANT_TRACKING_PLANE_ORIENTATION.HORIZONTAL (0°)
Events
onChangedState
The trigger fires when the Tracker changes its internal state.
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 onChangedState.
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.
onError
The trigger fires when the Tracker could not be instantiated by the engine.
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.