Exemplo n.º 1
0
        private void Start()
        {
            arLocationOrientation = GetComponent <ARLocationOrientation>();
            arLocationProvider    = ARLocationProvider.Instance;

            if (WaitForARTrackingToStart)
            {
                arLocationProvider.Mute();
            }

            #if !ARGPS_USE_VUFORIA
            var arSession = FindObjectOfType <ARSession>();

            if (!arSession)
            {
                throw new NullReferenceException("[AR+GPS][ARLocationManager#Start]: No ARSession found in the scene!");
            }

            SessionManager = new ARFoundationSessionManager(arSession);
            #else
            SessionManager = new VuforiaSessionManager();
            #endif

            SessionManager.DebugMode = DebugMode;

            SessionManager.OnARTrackingStarted(ARTrackingStartedCallback);
            SessionManager.OnARTrackingRestored(ARTrackingRestoredCallback);
            SessionManager.OnARTrackingLost(ARTrackingLostCallback);

            groundHeightDummy = new GameObject("ARLocationGroundHeight");
            groundHeightDummy.transform.SetParent(MainCamera.transform);
            groundHeightDummy.transform.localPosition = new Vector3();
            groundHeight = groundHeightDummy.AddComponent <GroundHeight>();
        }
Exemplo n.º 2
0
        private void Start()
        {
            arLocationOrientation = GetComponent <ARLocationOrientation>();
            arLocationProvider    = ARLocationProvider.Instance;

            if (WaitForARTrackingToStart)
            {
                arLocationProvider.Mute();
            }

            #if !ARGPS_USE_VUFORIA
            var arSession = FindObjectOfType <ARSession>();

            if (!arSession)
            {
                throw new NullReferenceException("[AR+GPS][ARLocationManager#Start]: No ARSession found in the scene!");
            }

            SessionManager = new ARFoundationSessionManager(arSession);
            #else
            SessionManager = new VuforiaSessionManager();
            #endif

            SessionManager.DebugMode = DebugMode;

            SessionManager.OnARTrackingStarted(ARTrackingStartedCallback);
            SessionManager.OnARTrackingRestored(ARTrackingRestoredCallback);
            SessionManager.OnARTrackingLost(ARTrackingLostCallback);
        }