Exemplo n.º 1
0
        public override bool IsHandClosed(Hand handId)
        {
#if VRTK_DEFINE_STEAMVR_PLUGIN_2_0_0_OR_NEWER
            SteamVR_Action_Skeleton actionToUse = handId == Hand.Left ? leftSkeletonAction : rightSkeletonAction;
            bool isClose = true;

            foreach (Finger finger in (Finger[])Enum.GetValues(typeof(Finger)))
            {
                isClose = isClose && IsFingerBent(handId, finger);
            }

            return(isClose);
#else
            return(false);
#endif
        }
Exemplo n.º 2
0
        public override bool IsHandOpen(Hand handId)
        {
#if VRTK_DEFINE_STEAMVR_PLUGIN_2_0_0_OR_NEWER
            SteamVR_Action_Skeleton actionToUse = handId == Hand.Left ? leftSkeletonAction : rightSkeletonAction;
            bool isOpen = true;

            for (int n = 0; n < actionToUse.fingerCurls.Length; n++)
            {
                isOpen = isOpen && (actionToUse.fingerCurls[n] < FINGER_OPEN_THRESHOLD);
            }

            return(isOpen);
#else
            return(false);
#endif
        }
Exemplo n.º 3
0
        public override bool IsFingerBent(Hand handId, Finger fingerId)
        {
#if VRTK_DEFINE_STEAMVR_PLUGIN_2_0_0_OR_NEWER
            float curlValue;
            SteamVR_Action_Skeleton actionToUse = handId == Hand.Left ? leftSkeletonAction : rightSkeletonAction;

            switch (fingerId)
            {
            case Finger.Thumb:
                return(actionToUse.thumbCurl >= THUMB_CLOSE_BEND_THRESHOLD);

            case Finger.Index:
                curlValue = actionToUse.indexCurl;
                break;

            case Finger.Middle:
                curlValue = actionToUse.middleCurl;
                break;

            case Finger.Ring:
                curlValue = actionToUse.ringCurl;
                break;

            case Finger.Pinky:
                curlValue = actionToUse.pinkyCurl;
                break;

            default:
                curlValue = 0;
                break;
            }

            return(curlValue >= FINGER_CLOSE_BEND_THRESHOLD);
#else
            return(false);
#endif
        }
Exemplo n.º 4
0
 /// <summary>
 /// Retrieve the final animated pose, to be applied to a hand skeleton
 /// </summary>
 /// <param name="forAction">The skeleton action you want to blend between</param>
 /// <param name="handType">If this is for the left or right hand</param>
 public SteamVR_Skeleton_PoseSnapshot GetBlendedPose(SteamVR_Action_Skeleton skeletonAction, HandType handType)
 {
     UpdatePose(skeletonAction, handType);
     return(GetHandSnapshot(handType));
 }