Hi Dastariel,
if I understand you correctly, depending on the need you can try the below two alternatives:
1) access the tracking status from any script, maybe inside Update or FoxedUpdate Monobehaviour methods:
foreach (TrackableBehaviour atb in TrackerManager.Instance.GetStateManager().GetActiveTrackableBehaviours())
{
if (atb.CurrentStatus == TrackableBehaviour.Status.TRACKED || atb.CurrentStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
{
// here goes the code for your animation
}
}
As you can see, the code simply filters the tracked and extended tracked trackables, from the active ones. In your case you should have 3 trackables, If you have more than 3, it is because in Vuforia the active trackables are not the just the ones assigned to the ImageTargets, but all trackables contained in databases enabled inside the ARCamera.
2) you can do something similar directly in the TrackableEventHandler attached tho your ImageTargert objects; there you will find the OnTrackableStateChanged, that handles the trackable's status changes: if you use the Vuforia default implementation, you will find that depending on status it will fire OnTrackingFound() or OnTrackingLost() where you may evaluate implementing the animation.
One thing: OnTrackingLost() is called during the initialization of Vuforia, so you have to make sure that your added code can run w/o problems during the initialization: use a flag taking care or this.
Hope this helps; sorry for the long message: I see only now how long it is... cheers!
Hi Dastariel,
if I understand you correctly, depending on the need you can try the below two alternatives:
1) access the tracking status from any script, maybe inside Update or FoxedUpdate Monobehaviour methods:
foreach (TrackableBehaviour atb in TrackerManager.Instance.GetStateManager().GetActiveTrackableBehaviours())
{
if (atb.CurrentStatus == TrackableBehaviour.Status.TRACKED || atb.CurrentStatus == TrackableBehaviour.Status.EXTENDED_TRACKED)
{
// here goes the code for your animation
}
}
As you can see, the code simply filters the tracked and extended tracked trackables, from the active ones. In your case you should have 3 trackables, If you have more than 3, it is because in Vuforia the active trackables are not the just the ones assigned to the ImageTargets, but all trackables contained in databases enabled inside the ARCamera.
2) you can do something similar directly in the TrackableEventHandler attached tho your ImageTargert objects; there you will find the OnTrackableStateChanged, that handles the trackable's status changes: if you use the Vuforia default implementation, you will find that depending on status it will fire OnTrackingFound() or OnTrackingLost() where you may evaluate implementing the animation.
One thing: OnTrackingLost() is called during the initialization of Vuforia, so you have to make sure that your added code can run w/o problems during the initialization: use a flag taking care or this.
Hope this helps; sorry for the long message: I see only now how long it is... cheers!