コード例 #1
0
 private void ApplyHandMotion_Rotation(HI5_Source source)
 {
     if (HandBones[m_INDEX_Hand] != null)
     {
         HandBones[m_INDEX_Hand].localEulerAngles = HI5_DataTransform.ToUnityEulerAngles(source.GetReceivedRotation(m_INDEX_Hand, HandType));
     }
 }
        //キャリブレーション中の処理
        private IEnumerator CalibrationProgressCheckCoroutine(HI5_Pose hI5Pose)
        {
            var frame = -1;
            var calibrationProgress = 0;
            var scale = Vector3.one;

            while (calibrationProgress < 100)
            {
                //キャリブレーションの進行具合を取得
                calibrationProgress    = HI5_Calibration.GetCalibrationProgress(hI5Pose);
                scale.x                = calibrationProgress / 100f;
                progressBar.localScale = scale;

                if (isOutputCalibrationProgress)
                {
                    Debug.Log($"{hI5Pose}: {calibrationProgress}%");
                }

                if (hI5Pose == HI5_Pose.BPose && _isPushExistingOpticalData)
                {
                    frame = frame++ >= (_leftPos.Count - 1) ? 0 : frame;

                    HI5_DataTransform.PushOpticalData("LHR-LEFT", OPTDeviceType.HTC_VIVE_Tracker, _leftPos[frame],
                                                      _leftRot[frame]);
                    HI5_DataTransform.PushOpticalData("LHR-RIGHT", OPTDeviceType.HTC_VIVE_Tracker, _rightPos[frame],
                                                      _rightRot[frame]);
                }

                yield return(null);
            }

            HI5_Calibration.OnCalibrationComplete(hI5Pose);
        }
コード例 #3
0
        private void ApplyFingerMotion(Hand hand, HI5_Source hi5Source, ref Vector3[] hi5EulerAngles)
        {
            for (var i = (ConstIndexHi5Hand + 1); i < ConstIndexNumOfHi5Bones; i++)
            {
                hi5EulerAngles[i] = HI5_DataTransform.ToUnityEulerAngles(hi5Source.GetReceivedRotation(i, hand));
            }

            SetFingerMuscle((int)hand, ref hi5EulerAngles);
        }
コード例 #4
0
    private void OnNewPoses(TrackedDevicePose_t[] poses)
    {
        if (!m_SteamVR_TrackedObject.isValid)
        {
            return;
        }

        int index = (int)m_SteamVR_TrackedObject.index;

        if (index == -1)
        {
            return;
        }

        if (poses.Length <= index)
        {
            return;
        }

        if (!poses[index].bDeviceIsConnected)
        {
            return;
        }

        if (!poses[index].bPoseIsValid)
        {
            return;
        }

        if (poses[index].eTrackingResult != ETrackingResult.Running_OK)
        {
            return;
        }

        // set index on this device
        m_Index = index;

        // get and check device type
        OPTDeviceType type = GetDeviceClass(index);

        if (type == OPTDeviceType.Unknown)
        {
            return;
        }

        // get and check device serial number
        string deviceSN = GetStringProperty((uint)index, ETrackedDeviceProperty.Prop_SerialNumber_String);

        if (deviceSN == null)
        {
            return;
        }

        m_DeviceSerialNumber = deviceSN;

        // get device position and rotation
        var        pose = new SteamVR_Utils.RigidTransform(poses[index].mDeviceToAbsoluteTracking);
        Vector3    pos  = pose.pos;
        Quaternion rot  = pose.rot;

        HI5_DataTransform.PushOpticalData(deviceSN, type, pos, rot);

        if (HI5_BindInfoManager.IsGloveBinded(Hand.LEFT) && HI5_BindInfoManager.IsGloveBinded(Hand.RIGHT))
        {
            return;
        }

        CheckDeviceBinded(index);
    }
コード例 #5
0
 private void ApplyHandMotion_Rotation(Hand hand, HI5_Source hi5Source, ref Vector3[] hi5EulerAngles)
 {
     hi5EulerAngles[ConstIndexHi5Hand] =
         HI5_DataTransform.ToUnityEulerAngles(hi5Source.GetReceivedRotation(ConstIndexHi5Hand, hand));
     SetHandRotation((int)hand, ref hi5EulerAngles);
 }