Software Archive
Read-only legacy content
17061 Discussions

Query the Tracker 2DPath

John_B_3
Beginner
381 Views

How would I set up a c# script in Unity to identify the current image file being tracked by Object Tracker?

Currently I am trying to do this by working off the existing code of Sample 7 Object Tracking, and adding a new script to the parent Cube GameObject.  I have added multiple Object Tracking subsections within the Tracking Actions GUI.  In each Object Tracking subsection the Tracker 2DPath points to a different image file.  It is set up to only allow one object to be tracked at a time even if two images are visible.  Everything works fine with that.

However, it is always showing the same virtual Cube GameObject that is nested within the parent Cube regardless of which image it is tracking.  I would like it to show different game obejcts based on the image it is tracking.

I would like to write a script that identifies which image file (Tracker 2DPath) is currently being tracked and based on that information takes further action.

In improper code it would be something like.

if(Tracker2Dpath == "image1.jpg"){

}

I cannot seem to find anyway to query for the Tracker2DPath.  I have looked through TrackingValues and QueryTracker and tried to implement the code in a variety of ways, but have gotten nowhere.

Can someone point me in the right direction?

Or is there a different method through running separate object trackers which will cause only one of them to run at any given time and the other object trackers related virtual objects to disappear when they are not the ones being tracked?

Thank you for any help,

JB

0 Kudos
0 Replies
Reply