// check thumb finger up/down
        protected bool isThumbDirection(Hand hand, Vector3 dir)
        {
            List <Finger> listOfFingers = hand.Fingers;

            for (int f = 0; f < listOfFingers.Count; f++)
            {
                Finger finger = listOfFingers [f];

                if (finger.Type == Finger.FingerType.TYPE_THUMB)
                {
                    float angleThumbFinger = angle2LeapVectors(finger.Direction,
                                                               UnityVectorExtension.ToVector(dir));
                    float angleThumbFinger2 = angle2LeapVectors(
                        finger.TipPosition - hand.PalmPosition, UnityVectorExtension.ToVector(dir));
                    //Debug.Log (angleThumbFinger + " " + angleThumbFinger2);
                    if (angleThumbFinger < deltaAngleThumb ||
                        angleThumbFinger2 < deltaAngleThumb)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
Example #2
0
        //Jason <PillarOfEden>
        public bool isFingerDirection(Hand hand, Finger.FingerType finterType, Vector3 dir, float deltaAngle)
        {
            List <Finger> listOfFingers = hand.Fingers;

            for (int f = 0; f < listOfFingers.Count; f++)
            {
                Finger finger = listOfFingers[f];

                if (finger.Type == finterType)
                {
                    float angleFinger = angle2LeapVectors(finger.Direction,
                                                          UnityVectorExtension.ToVector(dir));
                    float angleFinger2 = angle2LeapVectors(
                        finger.StabilizedTipPosition - hand.PalmPosition, UnityVectorExtension.ToVector(dir));
                    //Debug.Log (angleThumbFinger + " " + angleThumbFinger2);
                    if (angleFinger < deltaAngle ||
                        angleFinger2 < deltaAngle)
                    {
                        return(true);
                    }
                    else
                    {
                        return(false);
                    }
                }
            }
            return(false);
        }
        protected bool checkPalmNormalInXZPlane(Hand hand)
        {
            float anglePalmNormal = angle2LeapVectors(hand.PalmNormal, UnityVectorExtension.ToVector(Vector3.up));

            return(anglePalmNormal > 70 && anglePalmNormal < 110);
        }
 protected bool isPalmNormalSameDirectionWith(Hand hand, Vector3 dir)
 {
     return(isSameDirection(hand.PalmNormal, UnityVectorExtension.ToVector(dir)));
 }
Example #5
0
 public bool isPalmNormalSameDirectionWith(Hand hand, Vector3 dir, float handForwardDegree)
 {
     return(isSameDirection(hand.PalmNormal, UnityVectorExtension.ToVector(dir), handForwardDegree));
 }