Esempio n. 1
0
        public static Hand MakeTestHand(int frameId, int handId, bool isLeft)
        {
            FingerList fingers = new FingerList(5);
            fingers.Add(MakeThumb (frameId, handId));
            fingers.Add(MakeIndexFinger (frameId, handId));
            fingers.Add(MakeMiddleFinger (frameId, handId));
            fingers.Add(MakeRingFinger (frameId, handId));
            fingers.Add( MakePinky (frameId, handId));

            Vector armWrist = new Vector(-7.05809944059f, 4.0f, 50.0f);
            Vector elbow = armWrist + 250f * Vector.Backward;
            Matrix armBasis = new Matrix(Vector.Right, Vector.Down, Vector.Forward);
            Arm arm = new Arm(elbow,armWrist,(elbow + armWrist)/2, Vector.Forward, 250f, 41f, Bone.BoneType.TYPE_DISTAL, armBasis);
            Hand testHand = new Hand(frameId,
            handId,
            1.0f,
            0.0f,
            0.0f,
            0.0f,
            0.0f,
            85f,
            isLeft,
            0.0f,
            arm,
                fingers,
                new Vector (0,0,0),
                new Vector(0,0,0),
                new Vector(0,0,0),
                Vector.Down,
                Vector.Backward,
                new Vector(-4.36385750984f, 6.5f, 31.0111342526f)
            );

            if(isLeft){
                return testHand;
            } else {
                Matrix leftToRight = new Matrix(Vector.Right, Vector.Up, Vector.Forward);
                return testHand.TransformedCopy(leftToRight);
            }
        }
Esempio n. 2
0
 void UpdateFingers()
 {
     touches.Clear();
     // 更新所有手指
     for (int i = 0; i < fingers.Length; ++i)
     {
         Finger finger           = fingers[i];
         UnityEngine.Vector2 pos = UnityEngine.Vector2.zero;
         bool down = false;
         // 刷新输入状态
         inputProvider.GetInputState(finger.Index, out down, out pos);
         finger.Update(down, pos);
         if (finger.IsDown)
         {
             touches.Add(finger);
         }
     }
 }
Esempio n. 3
0
    void UpdateFingers()
    {
        touches.Clear();

        // update all fingers
        foreach( Finger finger in fingers )
        {
            Vector2 pos = Vector2.zero;
            bool down = false;

            // request fresh input state from provider
            inputProvider.GetInputState( finger.Index, out down, out pos );

            finger.Update( down, pos );
            
            if( finger.IsDown )
                touches.Add( finger );
        }
    }
Esempio n. 4
0
    void UpdateFingers()
    {
        touches.Clear();
        // update all fingers
        for (int i = 0; i < fingers.Length; ++i)
        {
            Finger finger = fingers[i];

            Vector2 pos  = Vector2.zero;
            bool    down = false;

            // request fresh input state from provider
            inputProvider.GetInputState(finger.Index, out down, out pos);
            finger.Update(down, pos);

            if (finger.IsDown)
            {
                touches.Add(finger);
            }
        }
    }
Esempio n. 5
0
        public Hand TransformedCopy(Matrix trs)
        {
            FingerList transformedFingers = new FingerList(5);
            for(int f = 0; f < this.Fingers.Count; f++)
                transformedFingers.Add(Fingers[f].TransformedCopy(trs));

            float hScale = trs.xBasis.Magnitude;
            return new Hand(_frameId,
                _id,
                _confidence,
                _grabStrength,
                _grabAngle,
                _pinchStrength,
                _pinchDistance,
                _palmWidth * hScale,
                _isLeft,
                _timeVisible,
                _arm.TransformedCopy(trs),
                transformedFingers,
                trs.TransformPoint(_palmPosition),
                trs.TransformPoint(_stabilizedPalmPosition),
                trs.TransformPoint(_palmVelocity),
                trs.TransformDirection(_palmNormal).Normalized,
                trs.TransformDirection(_direction).Normalized,
                trs.TransformPoint(_wristPosition)
            );
        }