Log in or register to post comments

How to reset the location of generated model after the model is tracked?

July 28, 2021 - 12:51am #1


I am using HoloLens 2 and Unity 2020.3.13f1 to apply Vuforia.

When I tracked the ModelTarget, the child model was not overlay it perfectly, so I would like to rescan the ModelTarget to get the better place for generating the child model. However, it has only restarted the scan process and the child model is still generated on the same place, even I applied the ResetDeviceTracker class in MenuOptions.cs.

Therefore, how can I clear the location history of previous generated model to relocate the model through the rescanning? 

Thank You!!!!


How to reset the location of generated model after the model is tracked?

July 29, 2021 - 1:15am #3

Thank you very much for your reply. Maybe because of my programming error or presentation problem, your suggestion cannot achieve my desired effect.

As the generated object is always dislocated by different scanning angle, I want to allocate it by re-tracking/scanning, as shown below. However, I am currently unable to do what I want via the MenuOptions.ResetDeviceTracker() method and the TrackabelSettings.cs, the location of generated object is on the same place after the rescan. Therefore, is it has a method to clear the history location of generated object?

Thank you!! 

Image icon Result.png10.29 KB

How to reset the location of generated model after the model is tracked?

July 28, 2021 - 1:45am #2


in the normal case  can try one of the options

1.) to stop / the extended Tracking - this means the  model is tracked only when the target is completely inside the device view

a good resource where you could look for the functionality – this are  the Vuforia HoloLens 1+2 examples (https://assetstore.unity.com/packages/templates/packs/vuforia-hololens-1-2-sample-for-unity-2020-2-and-later-183725) and also the Vuforia Core Example (mobile). I think because the HoloLens examples has some overhead for the functionality specific for the HoloLens device , so you can first easily  check , modify and test the functionality when we take the Vuforia Core Examples https://assetstore.unity.com/packages/templates/packs/vuforia-core-samples-99026

So further I want to refer to scene 3-ModelTargets(or in the HoloLens Example 2-ModelTargets) in the folder assets/SamplesResources/scenes

In this example we have the script TrackabelSettings.cs – folder assets/Common/scripts – and in the example this script is used as component of the “SettingsMenu” gameObject. In the example we can e.g. define a UI button and stop the extend tracking – means switch between extended tracking and tracked. With other words this will stop the extended tracking and track only if the target is currently, and entirely scanned in the correct view  by the camera . Otherwise the tracking will restart. For better understanding the principle here I want also to refer to the following articles:

Best Practices for Continued AR experiences

Device Tracking Overview

Interpreting Tracking State API Results

The following code used in UI button will toggle between extended tracking and tracking


        GameObject SettingsMenu = GameObject.FindWithTag("SettingsMenu");

        if (SettingsMenu == null) return;

        TrackableSettings trackSets = SettingsMenu.GetComponent<TrackableSettings>();

        print("==> trackSets.IsDeviceTrackingEnabled()=" + trackSets.IsDeviceTrackingEnabled());




When we test the functionality we can see that:

In the same view the tracking is continued by the extended tracking  and in the bottom view it is lost /only tracking/ and it shows the symbol for the guided view.

2.)Another aspect is to reset the tracking. To reset tracking we could check the button on the bottom right (picture) “reset”,  which will call MenuOptions.ResetDeviceTracker() method

It is implemented as:


public void ResetDeviceTracker()


It  should have similar effect to the code in the HoloLese examples for the reset call.

....But as you already mentioned that this will not work in your case. Did you check the behavior of the HoloLens Examples. So far I remember when you reset there the tracking and e.g. change the position of the target - e.g. Mars Viking Lander it will update the location - so far the target is recongnized therefore possibly this is an implementation  issue.. Sometime the device is still in extended tracking because the target is not recongnized ( bad light conditions , target quality , shining surfaces etc.)   You can check in the mentioned above HoloLens sample scene 2-ModelTargets - the VuforiaTargets and its child to see how different content is managed depending on the target which was selected.


Vuforia Engine Support

Image icon 2021-07-28_10-18-101.gif222.26 KB
Log in or register to post comments