KudanAR - Unity  1.6.0
Kudan.AR.Tracker Class Reference

Inherits Kudan.AR.TrackerBase.

Public Member Functions

 Tracker (Renderer background)
 Constructor for the Tracker class. On mobile devices, it needs a reference to the background in order to render to the target texture and display the camera feed. More...
 
override bool InitPlugin ()
 Initialise the plugin. More...
 
override void DeinitPlugin ()
 Deinitialise the plugin. More...
 
override float GetNativePluginVersion ()
 Get the native plugin version number. This is the version number of the native framework used for the current platform, not the version of the plugin itself. More...
 
override void SetApiKey (string key, string bundleId)
 Sets the API key to be checked by licensing later. More...
 
override int GetNumCameras ()
 Gets the total number of cameras connected to the device, including any built-in and any external webcams. More...
 
override bool StartInputFromImage (Texture2D image)
 Start input from a static image. This is useful for debugging purposes. More...
 
override bool StartInputFromCamera (int deviceIndex, int targetWidth, int targetHeight)
 Start input from a given camera device. More...
 
override void StopInput ()
 Stop all input. If tracking is running, this will also stop tracking. To restart input, StartInputFromCamera will need to be used again, followed by StartTracking. More...
 
override bool AddTrackable (byte[] data, string id, bool extensible)
 Adds a single trackable to the tracker from image data, names it with the given string, and applies any settings. More...
 
override bool AddTrackableSet (byte[] data, string id)
 Adds a .KARMarker data set to the tracker with a given name. More...
 
override void UpdateTracking ()
 Update tracking for the current platform. More...
 
override void StartTracking ()
 Start the tracker. If tracker is already running, a warning message will be logged instead. More...
 
override void StopTracking ()
 Stop the tracker. If tracking is already stopped, a warning message will be logged instead. More...
 
override bool EnableTrackingMethod (int trackingMethodId)
 Enable the given tracking method. More...
 
override bool DisableTrackingMethod (int trackingMethodId)
 Disable the given tracking method. More...
 
override bool GetMarkerRecoveryStatus ()
 Returns whether or not Marker Recovery is enabled on the tracker. More...
 
override void SetMarkerRecoveryStatus (bool status)
 Sets the marker recovery status. Enabling this feature allows for quicker re-detection if a marker is lost as well as making it easier to re-detect the marker from shallower angles and greater distances. This is a feature that we recommend everyone should generally enable. N.B. Enabling this feature will use a fraction more CPU power. More...
 
override void SetMarkerExtensibilityStatus (bool status)
 Sets the marker extensibility status. Enabling this feature allows the tracker to extend markers by using the space surrounding the marker. This allows for detection and tracking at much greater distances, though this should only be used with markers that are stationary. More...
 
override bool GetMarkerExtensibilityStatus ()
 Returns whether or not Extended Detection and Tracking is enabled on the tracker. More...
 
override void SetMaximumSimultaneousTracking (int maxToTrack)
 Set the maximum number of trackables which can be tracked at the same time.
More...
 
override void OnApplicationFocus (bool focusStatus)
 OnApplicationFocus is called when the application gains or loses focus. When the user goes back to the home screen or to another app, focus is lost, and this method is called with the argument set to false. When the user re-opens the app and focus is gained, this method is called with the argument set to true. More...
 
override void OnApplicationPause (bool pauseStatus)
 Method called when the app loses focus. Only needed on Android. More...
 
override void ArbiTrackStart (Vector3 position, Quaternion orientation)
 Start ArbiTrack on the current platform. More...
 
override void ArbiTrackStop ()
 Stop ArbiTrack and return to placement mode. More...
 
override bool ArbiTrackIsTracking ()
 Checks if arbitrary tracking is currently running. More...
 
override void ArbiTrackGetPose (out Vector3 position, out Quaternion orientation)
 Gets the current position and orientation of the markerless driver being tracked. More...
 
override void FloorPlaceGetPose (out Vector3 position, out Quaternion orientation)
 Gets the current position and orientation of the floor, relative to the device. More...
 
override void NativeRender ()
 
override void PostRender ()
 Method called just after the current frame has been drawn. Used only on the Android platform. More...
 
override void updateCam ()
 Update the camera being used by the editor plugin. For the native equivalent, see UpdateBackground for iOS, or updateAndroidTracking for Android. More...
 
void UpdateRotation ()
 Update the projection matrix depending on the orientation of the device. This accounts for Unity's own auto-rotation to keep everything the right way up. Only used on mobile. More...
 
- Public Member Functions inherited from Kudan.AR.TrackerBase
string GetPluginVersion ()
 Gets the current plugin version. More...
 
int GetNumTrackables ()
 Gets the number of trackables. More...
 
Trackable GetTrackable (int index)
 Gets a trackable at given index. More...
 
bool IsTrackingRunning ()
 Determines whether tracking is running. More...
 
void RemoveTrackable (string name)
 Removes a trackable with a given name. More...
 
void ClearTrackables ()
 Clears trackables. More...
 
void SetupRenderingCamera (float cameraNearPlane, float cameraFarPlane)
 Sets up the rendering camera. More...
 
bool AddTrackableSet (string path, string id)
 Adds the trackable from a given path with a given ID. More...
 
Texture GetTrackingTexture ()
 Gets the tracking texture. More...
 
int GetNumDetectedTrackables ()
 Gets the number of detected trackables. More...
 
Trackable GetDetectedTrackable (int index)
 Gets detected trackable at the given index. More...
 
Matrix4x4 GetProjectionMatrix ()
 Gets the projection matrix. More...
 
Trackable[] GetDetectedTrackablesAsArray ()
 Gets the detected trackables as array. More...
 
void SetArbiTrackFloorHeight (float floorHeight)
 

Static Public Member Functions

static Matrix4x4 ConvertNativeFloatsToMatrix (float[] r, float cameraAspect)
 Convert floats to a 4x4 Matrix. More...
 

Static Protected Member Functions

static Vector3 ConvertNativeFloatsToVector3 (float x, float y, float z)
 Convert floats to a 3-Dimensional Vector. More...
 
static Quaternion ConvertNativeFloatsToQuaternion (float x, float y, float z, float w)
 Convert floats to a Quaternion. More...
 

Additional Inherited Members

- Protected Attributes inherited from Kudan.AR.TrackerBase
List< Trackable_trackables = new List<Trackable>()
 List of trackables the user has loaded. More...
 
float _cameraNearPlane = 0.3f
 The default camera near plane value. More...
 
float _cameraFarPlane = 1000f
 The default camera far plane value. More...
 
float _floorHeight = 200.0f
 ArbiTracker default floor height. More...
 
System.Threading.Thread _trackingThread
 The tracking thread. More...
 
bool _isTrackingRunning
 Is tracking currently running? More...
 
Texture _finalTexture
 The texture used to render to the camera. More...
 
Matrix4x4 _projectionMatrix
 The projection matrix. More...
 
List< Trackable_detected = new List<Trackable>()
 List of detected trackables. More...
 
float _cameraRate
 The camera rate, number of times the camera feed refreshes each second. More...
 
float _trackerRate
 The tracker rate, the number of times the tracker updates each second. More...
 
float _appRate
 The app rate, the number of times the app updates each second. More...
 
Texture _clonedTexture
 The cloned texture. More...
 
- Properties inherited from Kudan.AR.TrackerBase
float CameraFrameRate [get]
 Gets the camera frame rate. More...
 
float TrackerFrameRate [get]
 Gets the tracker frame rate. More...
 
float AppFrameRate [get]
 Gets the app frame rate. More...
 

Constructor & Destructor Documentation

◆ Tracker()

Kudan.AR.Tracker.Tracker ( Renderer  background)
inline

Constructor for the Tracker class. On mobile devices, it needs a reference to the background in order to render to the target texture and display the camera feed.

Parameters
backgroundThe Renderer component attached to the background GameObject.

Member Function Documentation

◆ AddTrackable()

override bool Kudan.AR.Tracker.AddTrackable ( byte[]  data,
string  id,
bool  extensible 
)
inlinevirtual

Adds a single trackable to the tracker from image data, names it with the given string, and applies any settings.

Returns
true, if trackable was successfully added to the tracker, false otherwise.
Parameters
dataThe array of image data.
idA name applied to the trackable to identify it in the tracker while the app is running.
extensibleIf set to true the loaded trackable will use extended tracking.

Implements Kudan.AR.TrackerBase.

◆ AddTrackableSet()

override bool Kudan.AR.Tracker.AddTrackableSet ( byte[]  data,
string  id 
)
inlinevirtual

Adds a .KARMarker data set to the tracker with a given name.

Returns
true<c>/c>, if the data set was successfully added to the tracker, false otherwise.
Parameters
dataThe array of byte data from the data set.
idA string used to identify the data set while the app is running.

Implements Kudan.AR.TrackerBase.

◆ ArbiTrackGetPose()

override void Kudan.AR.Tracker.ArbiTrackGetPose ( out Vector3  position,
out Quaternion  orientation 
)
inlinevirtual

Gets the current position and orientation of the markerless driver being tracked.

Parameters
positionThe position of the markerless transform driver.
orientationThe orientation of the markerless transform driver.

Implements Kudan.AR.TrackerBase.

◆ ArbiTrackIsTracking()

override bool Kudan.AR.Tracker.ArbiTrackIsTracking ( )
inlinevirtual

Checks if arbitrary tracking is currently running.

Returns
true<c>/c>, if ArbiTrack is running false if not.

Implements Kudan.AR.TrackerBase.

◆ ArbiTrackStart()

override void Kudan.AR.Tracker.ArbiTrackStart ( Vector3  position,
Quaternion  orientation 
)
inlinevirtual

Start ArbiTrack on the current platform.

Parameters
positionPosition to start tracking at.
orientationOrientation to start tracking at.

Implements Kudan.AR.TrackerBase.

◆ ArbiTrackStop()

override void Kudan.AR.Tracker.ArbiTrackStop ( )
inlinevirtual

Stop ArbiTrack and return to placement mode.

Implements Kudan.AR.TrackerBase.

◆ ConvertNativeFloatsToMatrix()

static Matrix4x4 Kudan.AR.Tracker.ConvertNativeFloatsToMatrix ( float[]  r,
float  cameraAspect 
)
inlinestatic

Convert floats to a 4x4 Matrix.

Returns
A 4x4 Matrix created using the given floats.
Parameters
rAn array of 16 native floats.
cameraAspectThe aspect ratio of the camera.

◆ ConvertNativeFloatsToQuaternion()

static Quaternion Kudan.AR.Tracker.ConvertNativeFloatsToQuaternion ( float  x,
float  y,
float  z,
float  w 
)
inlinestaticprotected

Convert floats to a Quaternion.

Returns
A Quaternioin created using the given floats.
Parameters
xThe x coefficient.
yThe y coefficient.
zThe z coefficient.
wThe w coefficient.

◆ ConvertNativeFloatsToVector3()

static Vector3 Kudan.AR.Tracker.ConvertNativeFloatsToVector3 ( float  x,
float  y,
float  z 
)
inlinestaticprotected

Convert floats to a 3-Dimensional Vector.

Returns
A 3-Dimenionsal Vector created using the given floats.
Parameters
xThe x coordinate.
yThe y coordinate.
zThe z coordinate.

◆ DeinitPlugin()

override void Kudan.AR.Tracker.DeinitPlugin ( )
inlinevirtual

Deinitialise the plugin.

Implements Kudan.AR.TrackerBase.

◆ DisableTrackingMethod()

override bool Kudan.AR.Tracker.DisableTrackingMethod ( int  trackingMethodId)
inlinevirtual

Disable the given tracking method.

Returns
true<c>/c>, if the tracking method was disabled successfully, false otherwise.
Parameters
trackingMethodIdID of the tracking method to disable. Tracking methods are: 0 = Marker, 1 = Markerless.

Implements Kudan.AR.TrackerBase.

◆ EnableTrackingMethod()

override bool Kudan.AR.Tracker.EnableTrackingMethod ( int  trackingMethodId)
inlinevirtual

Enable the given tracking method.

Returns
true<c>/c>, if the tracking method was enabled successfully, false otherwise.
Parameters
trackingMethodIdID of the tracking method to enable. Tracking methods are: 0 = Marker, 1 = Markerless.

Implements Kudan.AR.TrackerBase.

◆ FloorPlaceGetPose()

override void Kudan.AR.Tracker.FloorPlaceGetPose ( out Vector3  position,
out Quaternion  orientation 
)
inlinevirtual

Gets the current position and orientation of the floor, relative to the device.

Parameters
positionPosition of the floor, relative to the camera.
orientationOrientation of the floor, relative to the camera.

Implements Kudan.AR.TrackerBase.

◆ GetMarkerExtensibilityStatus()

override bool Kudan.AR.Tracker.GetMarkerExtensibilityStatus ( )
inlinevirtual

Returns whether or not Extended Detection and Tracking is enabled on the tracker.

Returns
true, if marker extensibility status was gotten, false otherwise.

Implements Kudan.AR.TrackerBase.

◆ GetMarkerRecoveryStatus()

override bool Kudan.AR.Tracker.GetMarkerRecoveryStatus ( )
inlinevirtual

Returns whether or not Marker Recovery is enabled on the tracker.

Returns
true<c>/c>, if Marker Recovery is enabled. false if not.

Implements Kudan.AR.TrackerBase.

◆ GetNativePluginVersion()

override float Kudan.AR.Tracker.GetNativePluginVersion ( )
inlinevirtual

Get the native plugin version number. This is the version number of the native framework used for the current platform, not the version of the plugin itself.

Returns
The native plugin version number.

Implements Kudan.AR.TrackerBase.

◆ GetNumCameras()

override int Kudan.AR.Tracker.GetNumCameras ( )
inlinevirtual

Gets the total number of cameras connected to the device, including any built-in and any external webcams.

Returns
The total number of cameras connected to the device. On most smart devices, this number will be 2.

Implements Kudan.AR.TrackerBase.

◆ InitPlugin()

override bool Kudan.AR.Tracker.InitPlugin ( )
inlinevirtual

Initialise the plugin.

Returns
true, if the plugin initialised successfully, false otherwise.

Implements Kudan.AR.TrackerBase.

◆ OnApplicationFocus()

override void Kudan.AR.Tracker.OnApplicationFocus ( bool  focusStatus)
inlinevirtual

OnApplicationFocus is called when the application gains or loses focus. When the user goes back to the home screen or to another app, focus is lost, and this method is called with the argument set to false. When the user re-opens the app and focus is gained, this method is called with the argument set to true.

NOTE: On Android, when the on-screen keyboard is enabled, it causes a OnApplicationFocus( false ) event. Additionally, if you press Home at the moment the keyboard is enabled, the OnApplicationFocus() event is not called, but OnApplicationPause() is called instead.

Parameters
focusStatusTrue if the app has gained focus, false if it has lost focus.

Implements Kudan.AR.TrackerBase.

◆ OnApplicationPause()

override void Kudan.AR.Tracker.OnApplicationPause ( bool  pauseStatus)
inlinevirtual

Method called when the app loses focus. Only needed on Android.

Parameters
pauseStatusTrue if GameObjects have focus, False otherwise.

Implements Kudan.AR.TrackerBase.

◆ PostRender()

override void Kudan.AR.Tracker.PostRender ( )
inlinevirtual

Method called just after the current frame has been drawn. Used only on the Android platform.

Implements Kudan.AR.TrackerBase.

◆ SetApiKey()

override void Kudan.AR.Tracker.SetApiKey ( string  key,
string  bundleId 
)
inlinevirtual

Sets the API key to be checked by licensing later.

Parameters
keyThe full API Key, including hypens. The string must be an exact match to what is provided by Kudan.
bundleIdThe Bundle ID of your project. This is ignored.

Implements Kudan.AR.TrackerBase.

◆ SetMarkerExtensibilityStatus()

override void Kudan.AR.Tracker.SetMarkerExtensibilityStatus ( bool  status)
inlinevirtual

Sets the marker extensibility status. Enabling this feature allows the tracker to extend markers by using the space surrounding the marker. This allows for detection and tracking at much greater distances, though this should only be used with markers that are stationary.

Parameters
statusSet to true if Extended Detection and Tracking should be enabled, false if not.

Implements Kudan.AR.TrackerBase.

◆ SetMarkerRecoveryStatus()

override void Kudan.AR.Tracker.SetMarkerRecoveryStatus ( bool  status)
inlinevirtual

Sets the marker recovery status. Enabling this feature allows for quicker re-detection if a marker is lost as well as making it easier to re-detect the marker from shallower angles and greater distances. This is a feature that we recommend everyone should generally enable. N.B. Enabling this feature will use a fraction more CPU power.

Parameters
statusSet to true if Marker Recovery should be enabled, false if not.

Implements Kudan.AR.TrackerBase.

◆ SetMaximumSimultaneousTracking()

override void Kudan.AR.Tracker.SetMaximumSimultaneousTracking ( int  maxToTrack)
inlinevirtual

Set the maximum number of trackables which can be tracked at the same time.


Parameters
maxToTrack

The maximum number of trackables which can be simultaneously tracked

Implements Kudan.AR.TrackerBase.

◆ StartInputFromCamera()

override bool Kudan.AR.Tracker.StartInputFromCamera ( int  deviceIndex,
int  targetWidth,
int  targetHeight 
)
inlinevirtual

Start input from a given camera device.

Returns
true, if input was successfully started from a camera device, false otherwise.
Parameters
deviceIndexThe index of the camera to get input from. Back-facing devices always come first in the list. On a smart device with a back-facing and front-facing camera, the back-facing camera will have index 0, and the front-facing camera will have index 1. On a desktop device, the index corresponds to the connected USB webcams, if there are any.
targetWidthWidth component of the target resolution, in pixels.
targetHeightHeight component of the target resolution, in pixels.

Implements Kudan.AR.TrackerBase.

◆ StartInputFromImage()

override bool Kudan.AR.Tracker.StartInputFromImage ( Texture2D  image)
inlinevirtual

Start input from a static image. This is useful for debugging purposes.

Returns
true, if input was successfully started from the image, false otherwise.
Parameters
imageThe image that will be put into the tracker. If it contains a marker, the marker will be detected.

Implements Kudan.AR.TrackerBase.

◆ StartTracking()

override void Kudan.AR.Tracker.StartTracking ( )
inlinevirtual

Start the tracker. If tracker is already running, a warning message will be logged instead.

Implements Kudan.AR.TrackerBase.

◆ StopInput()

override void Kudan.AR.Tracker.StopInput ( )
inlinevirtual

Stop all input. If tracking is running, this will also stop tracking. To restart input, StartInputFromCamera will need to be used again, followed by StartTracking.

Implements Kudan.AR.TrackerBase.

◆ StopTracking()

override void Kudan.AR.Tracker.StopTracking ( )
inlinevirtual

Stop the tracker. If tracking is already stopped, a warning message will be logged instead.

Implements Kudan.AR.TrackerBase.

◆ updateCam()

override void Kudan.AR.Tracker.updateCam ( )
inlinevirtual

Update the camera being used by the editor plugin. For the native equivalent, see UpdateBackground for iOS, or updateAndroidTracking for Android.

Reimplemented from Kudan.AR.TrackerBase.

◆ UpdateRotation()

void Kudan.AR.Tracker.UpdateRotation ( )
inline

Update the projection matrix depending on the orientation of the device. This accounts for Unity's own auto-rotation to keep everything the right way up. Only used on mobile.

◆ UpdateTracking()

override void Kudan.AR.Tracker.UpdateTracking ( )
inlinevirtual

Update tracking for the current platform.

Implements Kudan.AR.TrackerBase.


The documentation for this class was generated from the following file: