Example #1
0
        HandState momentHandState()
        {
            Hand      hand           = leapManager.frontmostHand();
            ArrayList forwardFingers = LeapManager.forwardFacingFingers(hand);

            if (forwardFingers.Count == 0)
            {
                return(HandState.Fisting);
            }
            else if (forwardFingers.Count < 3)
            {
                float  minZ          = float.MaxValue;
                Finger forwardFinger = Finger.Invalid;

                foreach (Finger finger in forwardFingers)
                {
                    if (finger.TipPosition.z < minZ)
                    {
                        minZ          = finger.TipPosition.z;
                        forwardFinger = finger;
                    }
                }
                if (forwardFinger.IsValid && (forwardFinger.Type() == Finger.FingerType.TYPE_INDEX || forwardFinger.Type() == Finger.FingerType.TYPE_MIDDLE))
                {
                    return(HandState.Pointing);
                }
            }
            return(HandState.NoAction);
        }