Beispiel #1
0
    // Update is called once per frame
    void Update()
    {
        gestureDetected = Recognize();

        gestureNameDetected = gestureDetected.gestureName;

        if (gestureDetected.Equals(new Gesture()) && sthWasDetected)
        {
            sthWasDetected = false;
            onNothindDetected.Invoke();
        }
        else if (!gestureDetected.Equals(new Gesture()))
        {
            sthWasDetected = true;
            gestureDetected.onRecognized.Invoke();
        }

        // Debugging
        if (showDestinationPoints)
        {
            for (int i = 0; i < destinationPoints.Count; i++)
            {
                destinationPoints[i].transform.position = BaseHandObject.transform.TransformPoint(savedGestures[0].positionsPerFinger[i]);
            }
        }

        // Debugging
        if (usesPanel)
        {
            tmpro.text = "(" + gameObject.name + ") Theresold: " + theresold;
        }
    }
Beispiel #2
0
    // Update is called once per frame
    void Update()
    {
        // Updating bone data on tick
        fingerBones = new List <OVRBone>(skeleton.Bones);

        // When the space bar is pressed record gesture data
        if (Input.GetKeyDown(KeyCode.Space))
        {
            Save();
        }

        // Checking if we recognize a gesture on tick
        Gesture currentGesture = Recognize();
        bool    hasRecognized  = !currentGesture.Equals(new Gesture());

        // Checking if we are seeing a newly held gesture
        if (hasRecognized && !currentGesture.Equals(previousGesture))
        {
            // Display to console use of new gesture
            Debug.Log("New gesture used: " + currentGesture.name);

            // Setting our previous gesture to the current
            previousGesture = currentGesture;

            // Invoking unity onRecognized
            currentGesture.onRecognized.Invoke();
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (isRecognizing)
        {
            Gesture currentGesture = Recognize();
            bool    hasRecognized  = !currentGesture.Equals(new Gesture());

            if (hasRecognized && !currentGesture.Equals(previousGesture))
            {
                Debug.Log("New Gesture Found : " + currentGesture.name);
                previousGesture = currentGesture;
                currentGesture.onRecognized.Invoke();
            }
        }
    }
    private void Update()
    {
        gestureDetected     = Recognize();
        gestureNameDetected = gestureDetected.gestureName;

        if (gestureDetected.Equals(new Gesture()) && _sthWasDetected)
        {
            _sthWasDetected = false;
            onNothingDetected.Invoke();
        }
        else if (!gestureDetected.Equals(new Gesture()))
        {
            _sthWasDetected = true;
            gestureDetected.onRecognized.Invoke();
        }
    }
Beispiel #5
0
    // Update is called once per frame
    void Update()
    {
        if (debugMode) {
            if (Input.GetKeyDown(KeyCode.Space)) {
                Save();
            }
        }

        Gesture currentGesture = Recognize();
        //Debug.Log(currentGesture);
        bool hasRecognized = !currentGesture.Equals(new Gesture());

        if (hasRecognized && !currentGesture.Equals(previousGesture)) {
            Debug.Log("New Gesture Found: " + currentGesture.name);
            previousGesture = currentGesture;

            currentGesture.onRecognized.Invoke();
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (debugMode && Input.GetKeyDown(KeyCode.Space))
        {
            Save();
        }

        if (gestures.Count > 0)
        {
            Gesture currentGesture = Recognize();
            bool    hasRecognized  = !currentGesture.Equals(new Gesture());
            // Check if new Gesture


            if (hasRecognized && !currentGesture.Equals(previousGesture))
            {
                // New Gesture
                Debug.Log("New Geseture Found: " + currentGesture.name);
                previousGesture = currentGesture;
                currentGesture.onRecognized.Invoke();
            }
        }
    }
    // Update is called once per frame
    void Update()
    {
        if (righthand.activeSelf)
        {
            if (OnShoutOutHandsActive != null)
            {
                OnShoutOutHandsActive();
            }

            modeText.text = "Mode: hands";
            worktable.SetActive(false);


            fingerBones = new List <OVRBone>(skeleton.Bones);

            if (debugMode && Input.GetKeyDown(KeyCode.Space))
            {
                Save();
            }

            Gesture currenGesture = Recognize();
            bool    hasRecognized = !currenGesture.Equals(new Gesture());
            if (hasRecognized && !currenGesture.Equals(previousGesture))
            {
                Debug.Log("New gesture found: " + currenGesture.name);
                gestureText.text = "Detected: " + currenGesture.name;

                if (currenGesture.name == "Thumps Up" && !timerOn)
                {
                    TimeController.instance.BeginTimer();
                    timerOn = true;
                }
                else if (currenGesture.name == "Thumps Up" && timerOn)
                {
                    TimeController.instance.EndTimer();
                    timerOn = false;
                }

                //   GrabControl.Yell += GetGesture;

                if (OnShoutOutFistGesture != null && currenGesture.name == "Fist")
                {
                    OnShoutOutFistGesture();
                }

                if (OnShoutOutOpenHandGesture != null && currenGesture.name == "Open Hand")
                {
                    OnShoutOutOpenHandGesture();
                }



                //  Text txtmy = GameObject.Find("Canvas/mode_text");
                previousGesture = currenGesture;
                currenGesture.onRecognized?.Invoke();
            }
        }
        else
        {
            if (OnShoutOutHandsNotActive != null)
            {
                OnShoutOutHandsNotActive();
            }
            modeText.text = "Mode: controllers";
            worktable.SetActive(true);
        }
    }