Change tracking mode at runtime application
1. SDK Version: 6.0.1
2. Development Environment: Unity-Android
3. Tracker/Scanner: Barcode Scanner, Instant Tracking
4. License Type: Free
5. Target Device: Samsung A40
Hello,
Please tell me how to switch the tracking mode during program runtime. At the moment, the barcode scanner is launched first when button pressed, it works well. When a barcode is detected, the mode should switch to Instant tracking, but this does not happen. I tried 2 options:
1) Disable the object containing the Scan Simple Code and enable the object with Instant Trackable Behavior. In this case, the camera is simply paused and nothing else happens.
2) Send the command TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_INSTANT); but in this case, Instant Tracking does not turn on, leaving the Barcode Scanner active. Executing TrackerManager.GetInstance().StopTracker(); before the regime change did not help.
Please tell me the correct option for changing the mode while the program is running.
Thank you.
Thank you for your interest in MAXST AR SDK.
Call TrackerManager.GetInstance().StopTracker(), and then call TrackerManager.GetInstance().DestoryTracker() as well.
And when you run the new Tracker, it should work.
Best regards,
Shelden
MAXST Support Team
Yes, it works! Thank you very much for the solution!
One more question about tracking.
Switching to Instant Tracking from a barcode scan works fine. However, I need to scan another barcode, and after switching to the barcode scanner (which works well), there is a problem with re-enabling Instant Tracking - the object does not appear in front of the camera, as it did the first time. Is it possible to somehow reset the position of an object in Instant Tracking?
Thanks.
After Instant Tracker stops tracking, it must find the surface again to augment the object again.
If you stop tracking and want the object to stay where it is when you resume, we recommend using Instant Fusion Tracker.
If you call trackingManager.StopTracker before switching to another tracker, and then call trackingManager.StartTracker when you switch back to InstantFusionTracker, it should work as desired.
Best regards,
Shelden
MAXST Support Team
Thanks for your reply,
but no, I don't need the object to remain in the same place. I need the object to be placed in front of the camera when Instant Tracking is turned on again. But it is not placed in front of camera, and at the wrong angle, although the first time it is placed correctly. That's why I wanted to know about the reset.
It may be helpful to refer to the Start or OnDestroy functions when writing your code.
When stopping the InstantTracker:
SensorDevice.GetInstance().Stop();
TrackerManager.GetInstance().StopTracker();
When restarting the InstantTracker:
TrackerManager.GetInstance().StartTracker(TrackerManager.TRACKER_TYPE_INSTANT);
SensorDevice.GetInstance().Start();
Best regards,
Shelden
MAXST Support Team
Good afternoon,
Unfortunately, I again encountered the problem of switching the tracking mode after updating Unity MaxST to 6.1.0.
Can you please suggest how the following algorithm could be implemented:
- activation of barcode scanning mode
- switch to instant tracking when a barcode is found
- automatic placement of an object in front of the camera in instant tracking mode.
Thank you.
Nothing has changed in Instant Tracker or qr/barcode Tracker in 6.1.
Please check to see if you have overwritten any existing code while importing SDK 6.1.
It should work the same way in 6.1 as it did before.
Best regards,
Shelden
MAXST Support Team