Search Unity

Reset Tracker to destroy displayed object

Discussion in 'Vuforia' started by scythwolf, Jun 5, 2019.

  1. scythwolf

    scythwolf

    Joined:
    Dec 30, 2018
    Posts:
    49
    Hi!
    This might be something that is easily solved but I just can't manage to get to the solution (yeah, just started lately with Vuforia / Unity).

    Basic Setting: Vuforia with Ground Plane Detection. Several Object available to be displayed in AR. They can be chosen / selected by Toggles. Both Vuforia and Unity are at the newest available versions, I test with an Webcam and GroundPlane Printout.

    When I place an object A it is (of course) displayed. As soon as I place another object B both are displayed (GameObject A is disabled by SetActive(false) ). That led me to the conclusion that I have to destroy the object in AR by resetting Vuforia. Looking at the Vuforia Samples I found the function ResetScene() and ResetTrackers() and implemented a button to reset the Trackers (and the scene) since my goal is to destroy all displayed objects so a newly selected one may be displayed.

    I went through the whole Script and implemented what I needed in my opinion. The function is called ResetAll() and looks like this:
    Code (CSharp):
    1. public void resetAll()
    2.     {
    3.         //Debug.Log("Reset Scene");
    4.         //UtilityHelper.EnableRendererColliderCanvas(this.placementAugmentation, false);
    5.  
    6.         Debug.Log("Reset Trackers called");
    7.         smartTerrain = TrackerManager.Instance.GetTracker<SmartTerrain>();
    8.         positionalDeviceTracker = TrackerManager.Instance.GetTracker<PositionalDeviceTracker>();
    9.  
    10.         this.smartTerrain.Stop();
    11.         this.positionalDeviceTracker.Reset();
    12.         this.smartTerrain.Start();
    13.     }
    Unfortunately this doesn't do anything. As you can see I commented that UtilityHelper line out. Inside the samples this is used inside ResetScene(), placementAugmentation holds the displayed GameObject. Unfortunately UtilityHelper is not recognized. I included the same namespaces.

    Any help is greatly appreciated.

    Thanks!


    Edit: Also function is called properly and the statements are executed also but still the object is displayed.
    upload_2019-6-5_14-46-49.png
     
    Last edited: Jun 5, 2019
  2. scythwolf

    scythwolf

    Joined:
    Dec 30, 2018
    Posts:
    49
    Now... I tried to install it on the phone. This is where things get interesting: IT WORKS ON THE PHONE. But not on PC. Is there a reason for that behaviour?
     
    chenkun8991 likes this.