Пример #1
0
    /// <summary>
    /// Function for starting SLAMflex until enough points for generation of map is found
    /// </summary>
    /// <returns></returns>
    private IEnumerator AutoEnd()
    {
        autoend = true;
        while (autoend)
        {
            yield return(new WaitForSeconds(1f));

            SlamFlexWrapper.StartPlaneDetection();
            Debug.Log("AutoEnd finished");
        }
    }
Пример #2
0
    /// <summary>
    /// Function for unity3D GUI
    /// </summary>
    void OnGUI()
    {
        if (GUI.Button(new Rect(Screen.width * 0.9f, 0, Screen.width * 0.1f, Screen.width * 0.1f), "Exit"))
        {
            Debug.Log("Unity_ App exits");
            Application.Quit();
        }

        if (GUI.Button(new Rect(Screen.width - (Screen.width * 0.3f), (Screen.height - (Screen.width * 0.3f)), Screen.width * 0.3f, Screen.width * 0.3f), "Start Plane Detection"))
        {
            Debug.Log("Unity_ Tracking started");
            planeRotationFound = false;
            this._ground_plane.SetActive(false);
            Camera.main.transform.eulerAngles = Vector3.zero;
            SlamFlexWrapper.StartPlaneDetection();
            StartCoroutine(AutoEnd());
        }

        if (GUI.Button(new Rect(0, (Screen.height - (Screen.width * 0.3f)), Screen.width * 0.3f, Screen.width * 0.3f), "Stop Plane Detection"))
        {
            Debug.Log("Unity_ Tracking stoped");
            planeRotationFound = false;
            this._ground_plane.transform.position = orginalPlainePosition;
            this._ground_plane.SetActive(false);
            Camera.main.transform.eulerAngles = Vector3.zero;
            SlamFlexWrapper.StopSlam();
        }

        string text = "";

        if (autoend)
        {
            text = "\nMessages: " + userMessagesTextInstr + "\n" + userMessagesText + "\n" + userMessagesText1;
        }
        else
        {
            text = "\nMessages: " + userMessagesText + "\n" + userMessagesText1;
        }


        GUI.Label(new Rect(0f, 0f, 200, 200), "Current tracking state: " + current_State.ToString());
        GUI.Label(new Rect(0, 100, 400, 400), text);
    }