Hello,
I have a Unity application with mutiple augmented reality scenes, using ImageTargets. For some on these scenes, I need to use Extended Tracking, and not for some others.
So I want to be able to activate/disable the extended tracking dynamically. After reading the documentation, I understood the correct method was to use the InitTracker method from the TrackerManager class. So, In the VuforiaConfiguration, I have disabled the device tracker mode because by default, I dont want to use the extended tracking. and i created this class :
using System.Collections; using System.Collections.Generic; using UnityEngine; using Vuforia;
public class ExtendedTrackingManager : MonoBehaviour {
public bool mustInitExtendedTracking = false;
// Start is called before the first frame update void Awake() { VuforiaARController.Instance.RegisterVuforiaInitializedCallback(OnVuforiaInitialized); } void OnVuforiaInitialized() { Debug.Log("OnVuforiaInitialized ! - " + mustInitExtendedTracking); if (mustInitExtendedTracking) { DeviceTracker deviceTracker = TrackerManager.Instance.InitTracker<PositionalDeviceTracker>(); if (deviceTracker != null) { Debug.Log("deviceTracker.Start()"); deviceTracker.Start(); } } else { PositionalDeviceTracker deviceTracker = TrackerManager.Instance.InitTracker<PositionalDeviceTracker>(); if (deviceTracker != null) { Debug.Log("deviceTracker.Stop()"); deviceTracker.Reset(); deviceTracker.ResetAnchors(); deviceTracker.Stop(); } } }
// Update is called once per frame void Update() { } }
But the matter is that when the extended tracking should be enable, it doesn't work. The android logcat says : 03-18 17:49:35.117 17829 17878 I Unity : OnVuforiaInitialized ! - True 03-18 17:49:35.117 17829 17878 I Unity : 03-18 17:49:35.117 17829 17878 I Unity : (Filename: ./Runtime/Export/Debug.bindings.h Line: 45) 03-18 17:49:35.117 17829 17878 I Unity : 03-18 17:49:35.117 17829 17878 E Unity : PositionalDeviceTracker failed to initialize
If I try to disable the error is the same : 03-18 17:49:35.117 17829 17878 I Unity : OnVuforiaInitialized ! - Fale 03-18 17:49:35.117 17829 17878 I Unity : 03-18 17:49:35.117 17829 17878 I Unity : (Filename: ./Runtime/Export/Debug.bindings.h Line: 45) 03-18 17:49:35.117 17829 17878 I Unity : 03-18 17:49:35.117 17829 17878 E Unity : PositionalDeviceTracker failed to initialize
What is the correct method to enable/disable extended tracking ?
Unity 2018 3.x Vuforia 8x
Hello,
Hello,
Hello medabit,
Hello medabit,
Thanks for your answer.
Maybe my question wasn't clear enough.
For now, in the application, we just have 2 possibilities : to activate or desactivate the extended tracking for all of the scenes.
You want to start/stop the
You want to start/stop the PositionalDeviceTracker on a per scene basis.
This article describes how to Initialize the PDT if you don't want to start with it initialized/started for example: https://library.vuforia.com/articles/Solution/Configuring-Rotational-Tracking-in-Unity.html
pmessenger wrote:
[quote=pmessenger]
You want to start/stop the PositionalDeviceTracker on a per scene basis.
I had a quick look at your
I had a quick look at your project and it seems to be working for me. An easy way to verify if extended tracking is working is to cover a target and see if the augmentation is still displayed.
@pmessenger Hello Peter,
@pmessenger Hello Peter, thanks for your answer but it doesn't work. We didn't use the InitTracker method, it was in commented lines.