示例#1
0
        // Update is called once per frame
        private void Update()
        {
            manus_hand_t leftHand;
            manus_hand_t rightHand;

            _leftRet  = Manus.ManusGetHand(session, device_type_t.GLOVE_LEFT, out leftHand);
            _rightRet = Manus.ManusGetHand(session, device_type_t.GLOVE_RIGHT, out rightHand);
            // if the retrieval of the handdata is succesfull update the local value and wether the hand is closed
            if (_leftRet == manus_ret_t.MANUS_SUCCESS)
            {
                _leftHand = leftHand;
                UpdateCloseValue(TotalAverageValue(_leftHand), device_type_t.GLOVE_LEFT);
            }

            if (_rightRet == manus_ret_t.MANUS_SUCCESS)
            {
                _rightHand = rightHand;
                UpdateCloseValue(TotalAverageValue(_rightHand), device_type_t.GLOVE_RIGHT);
            }

            if (Input.GetKeyDown(AutomaticCalibration))
            {
                Calibrate(device_type_t.GLOVE_LEFT);
                Calibrate(device_type_t.GLOVE_RIGHT);
                Debug.Log("Calibrated the hands with the Vive trackers");
            }

            ManualWristRotation();
        }
示例#2
0
        IEnumerator PlayRecording(List <manus_hand_t> handData, List <manus_ret_t> succeses, device_type_t deviceType)
        {
            while (true)
            {
                //Loop through data
                for (int i = 0; i < handData.Count; i++)
                {
                    yield return(new WaitForFixedUpdate());

                    if (succeses.Count > 0)
                    {
                        if (deviceType == device_type_t.GLOVE_LEFT)
                        {
                            _leftRet = succeses[i];
                        }
                        else
                        {
                            _rightRet = succeses[i];
                        }
                        if (succeses[i] != manus_ret_t.MANUS_SUCCESS)
                        {
                            continue;
                        }
                    }
                    else
                    {
                        _leftRet  = manus_ret_t.MANUS_SUCCESS;
                        _rightRet = manus_ret_t.MANUS_SUCCESS;
                    }

                    var manusHandT = handData[i];

                    switch (deviceType)
                    {
                    case device_type_t.GLOVE_LEFT:
                        _leftHand = manusHandT;
                        UpdateCloseValue(TotalAverageValue(_leftHand), deviceType);
                        break;

                    case device_type_t.GLOVE_RIGHT:
                        _rightHand = manusHandT;
                        UpdateCloseValue(TotalAverageValue(_rightHand), deviceType);
                        break;
                    }
                }
            }
        }
        // Update is called once per frame
        private void Update()
        {
            manus_hand_t leftHand;
            manus_hand_t rightHand;

            _leftRet  = Manus.ManusGetHand(session, device_type_t.GLOVE_LEFT, out leftHand);
            _rightRet = Manus.ManusGetHand(session, device_type_t.GLOVE_RIGHT, out rightHand);
            // if the retrieval of the handdata is succesfull update the local value and wether the hand is closed
            if (_leftRet == manus_ret_t.MANUS_SUCCESS)
            {
                _leftHand = leftHand;
                UpdateCloseValue(TotalAverageValue(_leftHand), device_type_t.GLOVE_LEFT);
            }

            if (_rightRet == manus_ret_t.MANUS_SUCCESS)
            {
                _rightHand = rightHand;
                UpdateCloseValue(TotalAverageValue(_rightHand), device_type_t.GLOVE_RIGHT);
            }

            ManualWristRotation();
        }