Beispiel #1
0
    public void RepositionCharacterAfterPlaneLost(GameObject character)
    {
        AndroidUtils.ShowAndroidToastMessage("Repositioning character after plane lost call!");
        DetectedPlane planeToPlaceOn = DetectedPlanes.Find(list => list.TrackingState == TrackingState.Tracking);

        if (planeToPlaceOn != null)
        {
            character.transform.position = planeToPlaceOn.CenterPose.position;
            character.GetComponent <AguController>().SetCurrentPlane(planeToPlaceOn);
        }
        else
        {
            Destroy(character);
            characterNeedsInit = true;
        }
    }
Beispiel #2
0
    private void UpdateApplicationLifecycle()
    {
        if (Input.GetKey(KeyCode.Escape))
        {
            Application.Quit();
        }

        if (Session.Status != SessionStatus.Tracking)
        {
            const int lostTrackingSleepTimeout = 15;
            Screen.sleepTimeout = lostTrackingSleepTimeout;
        }
        else
        {
            Screen.sleepTimeout = SleepTimeout.NeverSleep;
        }

        if (isQuitting)
        {
            return;
        }

        if (Session.Status == SessionStatus.ErrorPermissionNotGranted)
        {
            AndroidUtils.ShowAndroidToastMessage("Camera permission is needed to run this application.");
            isQuitting = true;
            StartCoroutine(DoQuitWithDelay());
        }
        else if (Session.Status.IsError())
        {
            AndroidUtils.ShowAndroidToastMessage(
                "ARCore encountered a problem connecting.  Please start the app again.");
            isQuitting = true;
            StartCoroutine(DoQuitWithDelay());
        }
    }
Beispiel #3
0
    private void _UpdateApplicationLifeCycle()
    {
        // exit app on back pressed
        if (Input.GetKey(KeyCode.Escape))
        {
            Application.Quit();
        }
        // Only allow the screen to sleep when not tracking.
        if (Session.Status != SessionStatus.Tracking)
        {
            const int lostTrackingSleepTimeout = 15;
            Screen.sleepTimeout = lostTrackingSleepTimeout;
        }
        else
        {
            Screen.sleepTimeout = SleepTimeout.NeverSleep;
        }
        if (_IsQuitting)
        {
            return;
        }

        // Quit if ARCore was unable to connect and give Unity some time for the toast to appear.
        if (Session.Status == SessionStatus.ErrorPermissionNotGranted)
        {
            AndroidUtils.ShowAndroidToastMessage("Camera permission is needed to run this application");
            _IsQuitting = true;
            StartCoroutine(_DoQuitWithDelay(0.5f));
        }
        else if (Session.Status.IsError())
        {
            AndroidUtils.ShowAndroidToastMessage("ARCore connecting problem. Please start the app again.");
            _IsQuitting = true;
            StartCoroutine(_DoQuitWithDelay(0.5f));
        }
    }