Wikitude Unity Plugin
Public Member Functions | Public Attributes | Properties | List of all members
Wikitude.InstantTracker Class Reference

Instant Trackers provide markerless 3D tracking of a scene, allowing to place augmentations anywhere in the real world. An Instant Tracker can be in two states: Initializing, during which the tracking origin can be set; and Tracking, during which the scene is being tracker. More...

Inheritance diagram for Wikitude.InstantTracker:
Wikitude.TrackerBehaviour

Public Member Functions

void SetState (InstantTrackingState state)
 Request that the tracker change to a new state. When the tracker actually changes to that state, the OnStateChange will be called. More...
 
bool CanStartTracking ()
 Queries whether the state can be changed from initialization to tracking. More...
 
void ConvertScreenCoordinate (Vector2 screenCoordinate)
 Use this method to perform a hit test on the point cloud coming from the instant tracker. The computation is done on a separate thread and the result is passed to OnScreenConversionComputed. More...
 
void RequestPointCloud ()
 Use this method to request the current point cloud from the instant tracker. The computation is done on a separate thread and the result is passed to OnPointCloudRequestFinished. More...
 
void IsPlatformAssistedTrackingSupported (Action< SmartAvailability > callback)
 Starts an async query to check if this device offers platform tracking capabilities to be used by SMART. This should only be called after WikitudeCamera is initialized, during the Start method. More...
 
void SaveCurrentInstantTarget (string path, Action< string > successHandler=null, Action< Error > errorHandler=null)
 Use this method to persist the currently tracked instant tracking session as a file. Saving the current session as an instant target happens on a background thread. In case the given directory does not exist, the error handler is called with a description and more details. In case the directory exists and a file with the same name in it exists, it will be overridden. The file type is .wto. More...
 
void LoadInstantTarget (TargetCollectionResource instantTargetResource, InstantTargetRestorationConfiguration configuration, Action< string > successHandler=null, Action< Error > errorHandler=null)
 Use this method to load a previously stored instant target. Loading an instant target happens on a background thread. More...
 
void LoadInstantTarget (TargetCollectionResource instantTargetResource, InstantTargetRestorationConfiguration configuration)
 Use this method to load a previously stored instant target. Loading an instant target happens on a background thread. More...
 

Public Attributes

OnStateChangedEvent OnStateChanged = new OnStateChangedEvent()
 Called whenever the internal state of the tracker is changed, as a result of calling SetState More...
 
OnFailedStateChangeEvent OnFailedStateChange = new OnFailedStateChangeEvent()
 Called after an instant tracker failed to change its state internally. More...
 
OnErrorEvent OnError = new OnErrorEvent()
 Called whenever the instant tracker encounters an unexpected error. More...
 
OnScreenConversionComputedEvent OnScreenConversionComputed = new OnScreenConversionComputedEvent()
 Called when a screen conversion computation has finished. More...
 
OnPointCloudRequestFinishedEvent OnPointCloudRequestFinished = new OnPointCloudRequestFinishedEvent()
 Called when the point cloud request has finished. More...
 
- Public Attributes inherited from Wikitude.TrackerBehaviour
OnTargetsLoadedEvent OnTargetsLoaded = new OnTargetsLoadedEvent()
 Called when a tracker was successfully initialized. More...
 
OnErrorLoadingTargetsEvent OnErrorLoadingTargets = new OnErrorLoadingTargetsEvent()
 Called when the targets could not be loaded.

Parameters
errorThe error describing what went wrong.
More...
 
OnInitializationErrorEvent OnInitializationError = new OnInitializationErrorEvent()
 Called when the tracker could not be initialized.

Parameters
errorThe error describing what went wrong.
More...
 

Properties

bool SMARTEnabled [get, set]
 Gets or sets whether SMART should to be used or not. More...
 
float DeviceHeightAboveGround [get, set]
 Allows changing the estimated height at which the device is currently above the ground in meters. Setting this to an appropriate value will allow the augmentations to have a scale close to the one they would have in reality. Can only be set if the tracker is in the Initializing state. More...
 
InstantTrackingPlaneOrientation TrackingPlaneOrientation [get, set]
 Gets or sets the tracking plane orientation with which instant tracking initializes. If the plane orientation is set to custom, then the TrackingPlaneOrientationAngle will be used. Can only be set if the tracker is in the Initializing state. More...
 
float TrackingPlaneOrientationAngle [get, set]
 Gets or sets the tracking plane orientation angle in degrees. Can only be set while the tracker is in Initializing state. It is only considered if the TrackingPlaneOrientation is set to Custom. Valid values are between -360 and 360 degrees. More...
 
TrackerEfficiencyMode TrackerEfficiencyMode [get, set]
 Defines the efficiency mode for the tracker. Has to be set before OnEnable is called, otherwise it will have no effect. More...
 
bool PlaneDetectionEnabled [get, set]
 Defines if plane detecion is enabled for the tracker. More...
 
PlaneFilter PlaneFilter [get, set]
 Defines a plane filter for the tracker. More...
 
bool ConvexHullEnabled [get, set]
 Defines if a convex hull is enabled for the tracker. More...
 

Detailed Description

Instant Trackers provide markerless 3D tracking of a scene, allowing to place augmentations anywhere in the real world. An Instant Tracker can be in two states: Initializing, during which the tracking origin can be set; and Tracking, during which the scene is being tracker.

When Instant Trackers are created at runtime, make sure that all the relevant properties are set before the OnEnable method is called by Unity. At OnEnable, the native tracker is created and all information needs to be available.

Member Function Documentation

bool Wikitude.InstantTracker.CanStartTracking ( )
inline

Queries whether the state can be changed from initialization to tracking.

For Wikitude's instant tracking algorithm, this functionality currently always returns true because the state change is always possible. For platform assisted tracking (ARKit or ARCore), this function performs a hit test internally to check whether the state can be switched or not.

void Wikitude.InstantTracker.ConvertScreenCoordinate ( Vector2  screenCoordinate)
inline

Use this method to perform a hit test on the point cloud coming from the instant tracker. The computation is done on a separate thread and the result is passed to OnScreenConversionComputed.

Parameters
screenCoordinateThe 2D screen coordinate that should be converted
void Wikitude.InstantTracker.IsPlatformAssistedTrackingSupported ( Action< SmartAvailability >  callback)
inline

Starts an async query to check if this device offers platform tracking capabilities to be used by SMART. This should only be called after WikitudeCamera is initialized, during the Start method.

Parameters
callbackThe callback that will be called when the query finishes.
void Wikitude.InstantTracker.LoadInstantTarget ( TargetCollectionResource  instantTargetResource,
InstantTargetRestorationConfiguration  configuration,
Action< string >  successHandler = null,
Action< Error errorHandler = null 
)
inline

Use this method to load a previously stored instant target. Loading an instant target happens on a background thread.

Parameters
instantTargetResourceThe target collection resource that points to a .wto file (either on the device or a remote server).
configurationThe configuration object that should be used when loading the target.
successHandlerA completion handler that is called once the instant target is fully restored and ready for recognition.
errorHandlerA completion handler that is called in case the instant target could not be restored. The given Error contains more information why the operation failed.
void Wikitude.InstantTracker.LoadInstantTarget ( TargetCollectionResource  instantTargetResource,
InstantTargetRestorationConfiguration  configuration 
)
inline

Use this method to load a previously stored instant target. Loading an instant target happens on a background thread.

Parameters
instantTargetResourceThe target collection resource that points to a .wto file (either on the device or a remote server).
configurationThe configuration object that should be used when loading the target.
void Wikitude.InstantTracker.RequestPointCloud ( )
inline

Use this method to request the current point cloud from the instant tracker. The computation is done on a separate thread and the result is passed to OnPointCloudRequestFinished.

void Wikitude.InstantTracker.SaveCurrentInstantTarget ( string  path,
Action< string >  successHandler = null,
Action< Error errorHandler = null 
)
inline

Use this method to persist the currently tracked instant tracking session as a file. Saving the current session as an instant target happens on a background thread. In case the given directory does not exist, the error handler is called with a description and more details. In case the directory exists and a file with the same name in it exists, it will be overridden. The file type is .wto.

Parameters
pathA path including the file name to which the current session should be saved to.
successHandlerA completion handler that is called if the current session could be successfully stored at the given path. This handler might be called from a background thread.
errorHandlerA completion handler that is called in case the current session could not be successfully stored at the given path. The given Error contains more information why the operation failed.
void Wikitude.InstantTracker.SetState ( InstantTrackingState  state)
inline

Request that the tracker change to a new state. When the tracker actually changes to that state, the OnStateChange will be called.

Parameters
stateThe requested state to which the tracker should transition.

Member Data Documentation

OnErrorEvent Wikitude.InstantTracker.OnError = new OnErrorEvent()

Called whenever the instant tracker encounters an unexpected error.

OnFailedStateChangeEvent Wikitude.InstantTracker.OnFailedStateChange = new OnFailedStateChangeEvent()

Called after an instant tracker failed to change its state internally.

Parameters
failedStateThe state the tracker failed to change to.
errorAn error object describing the reason why the state change failed.
OnPointCloudRequestFinishedEvent Wikitude.InstantTracker.OnPointCloudRequestFinished = new OnPointCloudRequestFinishedEvent()

Called when the point cloud request has finished.

Parameters
pointCloudThe array of 3D points that form the current point cloud.
OnScreenConversionComputedEvent Wikitude.InstantTracker.OnScreenConversionComputed = new OnScreenConversionComputedEvent()

Called when a screen conversion computation has finished.

Parameters
successIndicates if the computation succeeded or not.
screenCoordinateThe original screen coordinate that requested the conversion.
pointCloudCoordinateThe converted 3D coordinate in the local space of the trackable.
OnStateChangedEvent Wikitude.InstantTracker.OnStateChanged = new OnStateChangedEvent()

Called whenever the internal state of the tracker is changed, as a result of calling SetState

Parameters
stateThe current state of the tracker.

Property Documentation

bool Wikitude.InstantTracker.ConvexHullEnabled
getset

Defines if a convex hull is enabled for the tracker.

float Wikitude.InstantTracker.DeviceHeightAboveGround
getset

Allows changing the estimated height at which the device is currently above the ground in meters. Setting this to an appropriate value will allow the augmentations to have a scale close to the one they would have in reality. Can only be set if the tracker is in the Initializing state.

bool Wikitude.InstantTracker.PlaneDetectionEnabled
getset

Defines if plane detecion is enabled for the tracker.

PlaneFilter Wikitude.InstantTracker.PlaneFilter
getset

Defines a plane filter for the tracker.

bool Wikitude.InstantTracker.SMARTEnabled
getset

Gets or sets whether SMART should to be used or not.

Returns
TrackerEfficiencyMode Wikitude.InstantTracker.TrackerEfficiencyMode
getset

Defines the efficiency mode for the tracker. Has to be set before OnEnable is called, otherwise it will have no effect.

InstantTrackingPlaneOrientation Wikitude.InstantTracker.TrackingPlaneOrientation
getset

Gets or sets the tracking plane orientation with which instant tracking initializes. If the plane orientation is set to custom, then the TrackingPlaneOrientationAngle will be used. Can only be set if the tracker is in the Initializing state.

float Wikitude.InstantTracker.TrackingPlaneOrientationAngle
getset

Gets or sets the tracking plane orientation angle in degrees. Can only be set while the tracker is in Initializing state. It is only considered if the TrackingPlaneOrientation is set to Custom. Valid values are between -360 and 360 degrees.