Пример #1
0
        /// <summary>
        /// Initializes Vuforia; called from Start
        /// </summary>
        public VuforiaUnity.InitError Start(string licenseKey)
        {
            int errorCode = initVuforiaWSA(licenseKey);

            if (errorCode >= 0)
            {
                InitializeSurface();

#if HOLOLENS_API_AVAILABLE
                // This determines if we are starting on a holographic device
                if (UnityEngine.VR.VRSettings.loadedDeviceName.Equals(UNITY_HOLOLENS_IDENTIFIER) &&
                    UnityEngine.VR.VRDevice.isPresent)
                {
                    // set the focus point setter implementation
                    VuforiaUnity.SetHoloLensApiAbstraction(new HoloLensApiImplementation());

                    Debug.Log("Detected Holographic Device");
                    if (!VuforiaUnity.SetHolographicAppCoordinateSystem(WorldManager.GetNativeISpatialCoordinateSystemPtr()))
                    {
                        return(VuforiaUnity.InitError.INIT_ERROR);
                    }
                }
#endif
            }
            return((VuforiaUnity.InitError)errorCode);
        }
        /// <summary>
        /// Called on start each time a new scene is loaded
        /// </summary>
        public void StartScene()
        {
#if HOLOLENS_API_AVAILABLE
            // This determines if we are starting on a holographic device
            if (UnityEngine.XR.XRSettings.loadedDeviceName.Equals(UNITY_HOLOLENS_IDENTIFIER) &&
                UnityEngine.XR.XRDevice.isPresent)
            {
                if (!VuforiaUnity.SetHolographicAppCoordinateSystem(UnityEngine.XR.WSA.WorldManager.GetNativeISpatialCoordinateSystemPtr()))
                {
                    Debug.LogError("Failed to set holographic coordinate system pointer!");
                }
            }
#endif
        }