"We offer new support options and therefor the forums are now in read-only mode! Please check out our Support Center for more information." - Vuforia Engine Team

Tracking Found/Lost & Delay Animation

Unity 2018.12.f1 Vuforia 7.5.26 (Playmaker 1.9) (ARCore 1.5)

My first post here... if I've done something wrong with the post, please let me know. Thank you.

2 Issues: OnTrackingLost/OnTrackingFound & Delay Animation Until Target Found

I have read and researched many posts about both these common issues and none seem to help resolve for recent Vuforia version 7.5.26 - I am now at a loss. I am not a coder but understand general/basic coding logic and use Playmaker to achieve things in Unity.

QUESTION 1: Knowing when target is found/lost is important to sequence events/setups I want to control. Using Playmaker, I currently cannot access or connect to the protected behavior/info from "DefaultTrackableEventHandler". I have come across a script someone made for doing this with Playmaker in the past but it doesn't work with current Vuforia version, script pasted below. (Vuforia Playmaker package also no longer works with newest Vuforia.)

Script has two (similar) errors that I have tried to resolve in many ways without success. I don't think knowledge of Playmaker is needed to help here... errors are with commands that aren't recognized and I'm looking to replace them with whatever is needed to make things work to access tracking found/lost info. (This single need is so critical yet surprisingly missing as a default feature from Vuforia it seems.)

Error: Type `DefaultTrackableEventHandler' does not contain a definition for `UnRegisterHandler' and no extension method `UnRegisterHandler' of type `DefaultTrackableEventHandler' could be found. Are you missing an assembly reference?

Second error is the same for "RegisterHandler".

I've tried things like "OnTrackingFound" and "OnTrackableStateChanged" but no go, even without errors.

Problematic lines are: _Tracker.UnRegisterHandler(this); _Tracker.RegisterHandler(this);

Script pasted below.

QUESTION 2: How to delay (children of image target) object animations from playing before image target is found. I have seen many posts from people (over the years) needing the same thing and have not found a working solution. (An additional option would be nice to reset animations when target lost and then found again, but this is secondary and would also require control to reset animations on a per object/case by case basis. Ie: not always and for everything.)

Most critical for me is Question #1... I may be able to address Question #2 myself with Playmaker if I can get access to lost/found target info occurring at runtime.

Script regarding Question #1 below (maybe this isn't even the way to go but seems like it would work with Playmaker if I could get past issue)....

----------------------------------------

// (c) Copyright HutongGames, LLC 2010-2011. All rights reserved.

using UnityEngine; using System.Collections;  using System.Collections.Generic; using Vuforia;

namespace HutongGames.PlayMaker.Actions { [ActionCategory("Augmented Reality")] [Tooltip("NOTE: Requires Qualcomm Augmented Reality SDK. Sends events based on the state of a Trackable object. Optionally control visibility of children to automatically show/hide objects.")] public class ARTrackableEvents : FsmStateAction {   [Tooltip("Game Object that has a TrackableBehaviour component. E.g., ImageTargetBehavior.")]   public FsmOwnerDefault gameObject;   [Tooltip("Event to send when the trackable is found.")]   public FsmEvent trackingFoundEvent;   [Tooltip("Event to send when the trackable is lost.")]   public FsmEvent trackingLostEvent;   [Tooltip("Automatically control visibility of children. Turns renderer on when trackable found, off when trackable lost.")]   public FsmBool controlVisibility;   public DefaultTrackableEventHandler _Tracker;   private GameObject go;   public string NameStr = "<unknown>";   public override void Reset()   {    gameObject = null;    //   controlVisibility = true;

  }   public override void OnEnter()   {    RegisterWithTracker();   }   public override void OnExit()   {    //            UnRegisterWithTracker();   }   public void UnRegisterWithTracker()   {    if (_Tracker != null)    {     Debug.Log("UNRegister this handler");     _Tracker.UnRegisterHandler(this);       //   <---- Here is issue    }   }   // Reigster the trackable event handler   public void RegisterWithTracker()   {    if (go != null) return;    go = Fsm.GetOwnerDefaultTarget(gameObject);

   if (go == null)    {     Finish();     return;    }    NameStr = go.name;    _Tracker = go.GetComponent<DefaultTrackableEventHandler>();    if(_Tracker!=null)    {     Debug.Log("Register this handler");     _Tracker.RegisterHandler(this);     //   <---- Here is issue    }   }

  public void OnTrackingFound()   {    Debug.Log("Tracking found !" + NameStr);    Fsm.Event(trackingFoundEvent);

  }

  public void OnTrackingLost()   {    Debug.Log("Tracking lost !" +NameStr);    Fsm.Event(trackingLostEvent);

  } } }

---------------------------------

Thank you!