예제 #1
0
        public HandPoseType GetHandPose(Hand hand)
        {
            HandPoseType type     = HandPoseType.Unknown;
            float        nonThumb = HandPoseUtility.NonThumbFingersGapAverage(hand);
            float        ti       = HandPoseUtility.FingerDistanceTI(hand);
            bool         t        = HandPoseUtility.GetFinger(hand, Finger.FingerType.TYPE_THUMB).IsExtended;
            bool         i        = HandPoseUtility.GetFinger(hand, Finger.FingerType.TYPE_INDEX).IsExtended;
            bool         m        = HandPoseUtility.GetFinger(hand, Finger.FingerType.TYPE_MIDDLE).IsExtended;
            bool         r        = HandPoseUtility.GetFinger(hand, Finger.FingerType.TYPE_RING).IsExtended;
            bool         p        = HandPoseUtility.GetFinger(hand, Finger.FingerType.TYPE_PINKY).IsExtended;

            foreach (HandPoseTemplate template in handPoses)
            {
                if (template.isMatch(nonThumb, ti, t, i, m, r, p))
                {
                    type = template.poseType;
                }
            }

            return(type);
        }
        void DebugUpdate()
        {
            if (debug)
            {
                debugText = "";
                if (rightHand != null)
                {
                    debugText = HandPoseUtility.GetHandFingerStats(rightHand);
                    DebugText("R Pincing " + isRightHandPinching, true);
                    DebugText("Velocity : " + rightHand.PalmVelocity.ToVector3(), true);
                    DebugText("R Pinch Strength " + rightHand.PinchStrength, true);
                }

                if (leftHand != null)
                {
                    debugText += HandPoseUtility.GetHandFingerStats(leftHand);
                    DebugText("L Pincing " + isRightHandPinching, true);
                    DebugText("Velocity : " + leftHand.PalmVelocity.ToVector3(), true);
                    DebugText("L Pinch Strength " + leftHand.PinchStrength, true);
                }

                DebugText("-----------REMOTE TOUCH------------------", true);
                DebugText("L Remote Touch State: " + leftHandRemoteTouch.state, true);
                DebugText("L Remote Touch Distance: " + leftHandRemoteTouch.currentDistance, true);
                DebugText("L Remote Touch Start Pos: " + leftHandRemoteTouch.touchStartPosition, true);
                DebugText("R Remote Touch State: " + rightHandRemoteTouch.state, true);
                DebugText("R Remote Touch Distance: " + rightHandRemoteTouch.currentDistance, true);
                DebugText("R Remote Touch Start Pos: " + rightHandRemoteTouch.touchStartPosition, true);

                DebugText("-----------GESTURE & POSE------------------", true);
                DebugText("L Detected: " + isLeftHandTracked, true);
                DebugText("L Pose: " + leftHandPose, true);
                DebugText("L Gesture: " + leftHandGesture, true);
                DebugText("R Detected: " + isRightHandTracked, true);
                DebugText("R Pose: " + rightHandPose, true);
                DebugText("R Gesture: " + rightHandGesture, true);
                DebugText("Gesture time " + (rightGestureRecognition.gestureTimeRate - (Time.time - rightGestureRecognition.lastPoseTime)), true);
            }
        }