Reputation: 1
I'm developing an app for MS HoloLens using Unity 2018.4.6, Vuforia image tracking and MRTK 2.0. The tracking of the target works fine and i can see my 3D object properly. But I would like to realise to disable the tracking function of vuforia by clicking on a button to keep the actual position of the 3d object in the world and to walk around it.
The disabling works also fine, but after disabling the tracking by using "VuforiaBehavior.Instance.enabled = false;" my 3d object disappears.
I find out, that I have to use a world anchor and I'm trying to solve it with the WorldAnchorManager of the MRTK2.0. But I don't know how to use it and if this would be my solution.
Does anybody have an answer for my question?
Upvotes: 0
Views: 1019
Reputation: 1
Some time is gone, but I have the solution. It was not the world anchor, in my case no anchor is needed. In the script provided by Vuforia (Assetes/Vuforia/Scripts/DefaultTrackableEventHandler.cs) the methods "OnTrackingFound" and "OnTrackingLost" automatically activate or deactivate the renderer components of the child game objects, i.e. also the renderer of the 3d objects. I'm not sure why HoloLens has such a behavior by default. A simple, but perhaps not the most elegant solution is to simply comment out the corresponding lines of code in the class (lines 88-105 and 111-128). This ensures that the objects remain visible even if the Vuforia tracking is lost.
Upvotes: 0
Reputation: 2900
Yes, if the true world-scale experiences on HoloLens APP that let users wander beyond 5 meters, you'll need to create a spatial anchor to lock the holograms precisely in place in the physical world.
The class WorldAnchorManager
in MRTK2 is for saving World Anchor states across multiple runs of the same application. You can choose whether you want to use it according to your needs.
So, your first step in placing holograms in your world is to determine which experience scale your app will target. You can go through the Coordinate systems in Unity which show the code to build the various scale experiences in Unity. Besides, if you want to understand the core concept of Coordinate systems in the HoloLens, please see: Coordinate systems.
Upvotes: 0