Hi there !
I’m currently trying to use Vuforia in two different contexts but in the same app and I can’t find a way to switch from a Ground Plane scene to a Cloud Recognition scene without Device Tracker.
I am working on Unity 2017.3.1f1 (Windows) with Vuforia 7.0.43, and I want to build my app on both Android and iOS mobileDevice.
What I want to do is :
- Detect an ImageTarget via CloudRecognition
- Unload the current CloudReco scene and load a GroundPlane scene with its own ARCamera and PlaneFinder
- Use a UI button to quit the experience : unload the GroundPlane scene and load a CloudRecognition scene with its own ARCamera and CloudRecoBehaviour
I actually manage to do that BUT I want the ARCamera in the CloudReco scene to be in FIRST_TARGET WorldCenterMode because some of my augmentations use Physics and need to be on an horizontal plane.
What’s happening right now is that the scenes are loaded but once I get back to CloudReco, the recognition works but the DeviceTracker is still starting and it blocks the camera on DEVICE_TRACKING WorldCenterMode (on the Unity Editor VuforiaBehaviour component the worldCenterMode is still set to FIRST_TARGET but the camera only moves around the GroundPlaneEmulator and is locked to (0,0,0) if the emulator is not detected, even with an other target detected).
I think the problem comes from the use of a DeviceTracker. As long as I don’t load the GroundPlane scene it doesn’t start when Vuforia starts, but once it has been used it is on Vuforia’s list of Trackers and it seems it cannot be removed. What I would like to do is prevent the DeviceTracker from starting automatically when initializing the cloudReco scene. I managed to prevent SmartTerrain from starting automatically thanks to the AutoInitAndStartTracker bool argument but it seems DeviceTracker has no such argument.
I tried to :
- Stop() the DeviceTracker before unloading the ground PlaneScene
- Stop() the DeviceTracker when loading the CloudReco scene
- Force Vuforia to Deinit() and Init() (with the DelayedInitialisation toggle whether on or off) when unloading and loading the scenes with the ARCameras
- Disable VuforiaBehaviour, CameraDevice and/or DefaultInitializationErrorHandler before changing scene and doing the Deinit() / Init()
- Manually change the WorldCenterMode by scripting
- Manually change the MixedRealityController mode to HANDLED_AR or HANDLED_AR_DEVICETRACKER while the CameraDevice is stopped
- Force the MixedRealityController mode to HANDLED_AR before initializing Vuforia when loading the CloudReco scene
- Use the ARCamera in SPECIFIC_TARGET WorldCenterMode and specify the target to follow on each NewSearchResult
I’m running out of idea to find a solution, does anyone has a solution for me ? It would be awesome !