Log in or register to post comments

[Double tracking] Ordered tracking

May 8, 2012 - 12:29pm #1

Hi everybody,
I'm working on a project with two trackables at the same time.
In the initialization the first trackable detected is the main trackable, the second one is just a simple trackable.
During the game, if trackables are lost, when the trackable are back I'd like to keep the order. I mean to not react to the second trackable and let the player get the first he gets at the beginning. Tell me if I'm not clear I'll try to explain it more precisely.
So, how and where in the API can I choose to call or not all the events related to tracking detection? Thanks :)

I tried to unactivate the wrong ImageTrackable (SetActiveRecursively), but I still receive the message from the API that the second trackable is detected.

Thanks !

Re: [Double tracking] Ordered tracking

May 9, 2012 - 10:56am #7

Ok, that's perfect, if I disable a tracker, he's no longer detected by the API.
Thanks a lot DavidBeard, you saved me so much time !

Oh, also I tried the camera NONE mode, after solved the issue that with Unity 3.5 the mode is not applied, and it doesn't correspond with my expectation, but whatever, disabling in real time trackables is perfect :)

Re: [Double tracking] Ordered tracking

May 9, 2012 - 7:18am #6

Thanks for your support :)
I started by changing the camera world mode.
I don't understand exactly how the NONE mode works, it changes nothing on my scene rendering.
USER mode could be great and useful, but at the beginning I don't know which trackable will be the first detected, and I've seen in the code this:

Quote:

Switching modes is not supported at runtime.

If I could use AUTO at the beginning to detect the first trackable and then switch to USER to force the camera to set its center to the first trackable it would be perfect.
I'll try to disable one tracker in runtime and activate it again.

Thanks again DavidBeard.

Re: [Double tracking] Ordered tracking

May 8, 2012 - 4:16pm #5

Take a look at the Swappable Datasets documentation under Getting Started - Unity Extension > Mastering Advanced Topics @ https://ar.qualcomm.at/qdevnet/sdk

See: Adding content to a Trackable

This will show you how to obtain the individuals Trackables. You can then disable or enable them individually.

e.g.

            
        // Activate all Trackables.
        int numTrackables = dataSet.GetNumTrackables();
        for (int i = 0; i < numTrackables; ++i)
        {
            TrackableBehaviour trackable = dataSet.GetTrackable(i);
            if (trackable != null)
            {
                trackable.enabled = true;
            }
        }

You can obtain the active dataset using the TrackerManager

            ImageTracker imageTracker = (ImageTracker)TrackerManager.Instance.GetTracker(Tracker.Type.IMAGE_TRACKER);
            DataSet dataSet = imageTracker.GetActiveDataSet();

I haven't experimented w/ disabling individual Trackables in a dataset, but they should be removed from the Trackables Queue when the Trackers are updated by QCARManager. Tell me if this doesn't work, and I'll look into a solution.

The relevant files are ImageTracker and QCARManager.

Also have you looked in to the World Center Mode settings on ARCamera? It sounds like you are using Auto. USER will allow you to assign a specific Trackable to serve as the origin, and NONE uses a fixed camera ( See: QCARBehaviour ).

Re: [Double tracking] Ordered tracking

May 8, 2012 - 3:07pm #4

It seams that on DefaultTrackableEventHandler I can only change the result event, but even if I remove everything on OnTrackingFound function, the API will call it and consider that this trackable is the first one, and the camera will turn around this one.
I want to stop the event going through the API to prevent changing the camera position, etc etc...

I'm quite sure the solution is on another file, the class that handle the list of active Trackables.

Re: [Double tracking] Ordered tracking

May 8, 2012 - 1:48pm #3

Oh yes, my fault, Trackable is what I mean, thanks :)
I tried to destroy and create again the second object, but when the first also disappears I've some NullExceptions. And it's very hard to debug when running on mobile platform...
I'll to take a look to this file,

Loic.

Re: [Double tracking] Ordered tracking

May 8, 2012 - 1:42pm #2

This is handled in the file DefaultTrackableEventHandler.cs - or you can implement your own event handler.

For the record , I think you mean Trackable ( or Target ). The Tracker is the component that detects and tracks the Trackables. So you want to control the event handling arising the states of the Trackables.

Log in or register to post comments