Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Stop Vuforia tracking and camera after it founds the Marker and reactivate after it loses

Discussion in 'AR/VR (XR) Discussion' started by Industry4O, Jul 3, 2019.

  1. Industry4O

    Industry4O

    Joined:
    Oct 30, 2018
    Posts:
    15
    Hello HoloLenser

    I have a Marker, which acts as my origin/zero point. My model is a child of the ImageTarget object.

    Everything works fine, but the whole scene tracking is really poor, when I walk a bit around in the room the tracking is lost and the model is disabled and the app is 'waiting' till the user re-scans the marker.

    I thought the problem is because of Vuforia which is still trying to find a Marker, while the user walks away, the tracking and spatial understanding of Hololens should be used.

    So in the MarkerDetectin.cs script in the onTrackingFound() event I have this:

    Code (CSharp):
    1.  protected virtual void OnTrackingFound()
    2.     {
    3.    //...
    4.        mTrackableBehaviour = GetComponent<TrackableBehaviour>();
    5.  
    6.         if (mTrackableBehaviour)
    7.         {
    8.             mTrackableBehaviour.UnregisterTrackableEventHandler(this);
    9.         }
    10.     }

    I notice a slightly different tracking quality, but its not really better => When the tracking is lost, the model is not just disabled (invisible), but it is repositioned 'somewhere', not really at the right place! So the user needs to go back to the Marker and scan it. And also I notice the Camera LED is still running even after UnregisterTrackableEventHandler() is called.

    Any ideas how I can make the whole tracking more stable?