예제 #1
0
        void Update()
        {
            if (RH_Mode && RH.GetReceivedStatus() == VRTRIXGloveStatus.NORMAL)
            {
                if (RH.GetReceivedRotation(VRTRIXBones.R_Hand) != Quaternion.identity && !qroffset_cal)
                {
                    qroffset     = CalculateStaticOffset(RH, HANDTYPE.RIGHT_HAND);
                    qroffset_cal = true;
                }

                if (IsVREnabled && RH_tracker != null)
                {
                    SetPosition(VRTRIXBones.R_Arm, RH_tracker.transform.position, RH_tracker.transform.rotation, RHTrackerOffset);
                }
                //以下是设置右手每个骨骼节点全局旋转(global rotation);
                for (int i = 0; i < (int)VRTRIXBones.L_Hand; ++i)
                {
                    SetRotation((VRTRIXBones)i, RH.GetReceivedRotation((VRTRIXBones)i), HANDTYPE.RIGHT_HAND);
                }

                RH.SetThumbOffset(thumb_offset_R[0], VRTRIXBones.R_Thumb_1);
                RH.SetThumbOffset(thumb_offset_R[1], VRTRIXBones.R_Thumb_2);
                RH.SetThumbOffset(thumb_offset_R[2], VRTRIXBones.R_Thumb_3);
                RH.SetThumbSlerpRate(thumb_proximal_slerp, thumb_middle_slerp);
                RH.SetFinalFingerSpacing(final_finger_spacing);
                RH.SetFingerSpacing(finger_spacing);
                RH_Gesture = GloveGesture.GestureDetection(RH, HANDTYPE.RIGHT_HAND);
            }



            if (LH_Mode && LH.GetReceivedStatus() == VRTRIXGloveStatus.NORMAL)
            {
                if (LH.GetReceivedRotation(VRTRIXBones.L_Hand) != Quaternion.identity && !qloffset_cal)
                {
                    qloffset     = CalculateStaticOffset(LH, HANDTYPE.LEFT_HAND);
                    qloffset_cal = true;
                }

                if (IsVREnabled && LH_tracker != null)
                {
                    SetPosition(VRTRIXBones.L_Arm, LH_tracker.transform.position, LH_tracker.transform.rotation, LHTrackerOffset);
                }

                //以下是设置左手每个骨骼节点全局旋转(global rotation);
                for (int i = (int)VRTRIXBones.L_Hand; i < (int)VRTRIXBones.R_Arm; ++i)
                {
                    SetRotation((VRTRIXBones)i, LH.GetReceivedRotation((VRTRIXBones)i), HANDTYPE.LEFT_HAND);
                }

                LH.SetThumbOffset(thumb_offset_L[0], VRTRIXBones.L_Thumb_1);
                LH.SetThumbOffset(thumb_offset_L[1], VRTRIXBones.L_Thumb_2);
                LH.SetThumbOffset(thumb_offset_L[2], VRTRIXBones.L_Thumb_3);
                LH.SetThumbSlerpRate(thumb_proximal_slerp, thumb_middle_slerp);
                LH.SetFinalFingerSpacing(final_finger_spacing);
                LH.SetFingerSpacing(finger_spacing);
                LH_Gesture = GloveGesture.GestureDetection(LH, HANDTYPE.LEFT_HAND);
            }
        }
        void Update()
        {
            if (RH_Mode && RH.GetReceivedStatus() == VRTRIXGloveStatus.NORMAL)
            {
                if (RH.GetReceivedRotation(VRTRIXBones.R_Hand) != Quaternion.identity && !qroffset_cal)
                {
                    qroffset     = CalculateStaticOffset(RH, HANDTYPE.RIGHT_HAND);
                    qroffset_cal = true;
                }

                if (IsVREnabled && RH_tracker != null)
                {
                    SetPosition(VRTRIXBones.R_Arm, RH_tracker.transform.position, RH_tracker.transform.rotation, RHTrackerOffset);
                }
                //以下是设置右手每个骨骼节点全局旋转(global rotation);
                for (int i = 0; i < (int)VRTRIXBones.L_Hand; ++i)
                {
                    SetRotation((VRTRIXBones)i, RH.GetReceivedRotation((VRTRIXBones)i), HANDTYPE.RIGHT_HAND);
                }
                RH_Gesture = GloveGesture.GestureDetection(RH, HANDTYPE.RIGHT_HAND);
            }



            if (LH_Mode && LH.GetReceivedStatus() == VRTRIXGloveStatus.NORMAL)
            {
                if (LH.GetReceivedRotation(VRTRIXBones.L_Hand) != Quaternion.identity && !qloffset_cal)
                {
                    qloffset     = CalculateStaticOffset(LH, HANDTYPE.LEFT_HAND);
                    qloffset_cal = true;
                }

                if (IsVREnabled && LH_tracker != null)
                {
                    SetPosition(VRTRIXBones.L_Arm, LH_tracker.transform.position, LH_tracker.transform.rotation, LHTrackerOffset);
                }

                //以下是设置左手每个骨骼节点全局旋转(global rotation);
                for (int i = (int)VRTRIXBones.L_Hand; i < (int)VRTRIXBones.R_Arm; ++i)
                {
                    SetRotation((VRTRIXBones)i, LH.GetReceivedRotation((VRTRIXBones)i), HANDTYPE.LEFT_HAND);
                }
                LH_Gesture = GloveGesture.GestureDetection(LH, HANDTYPE.LEFT_HAND);
            }
        }