Пример #1
0
        //Constructors:
        public ManagedHandSkeleton(ManagedHand managedHand)
        {
            //refs:
            _mainCamera = Camera.main;

            //sets:
            _managedHand = managedHand;

            //establish rotation offsets:
            _rotationOffsets = new List <Vector3>();
            _rotationOffsets.Add(Vector3.zero);
            _rotationOffsets.Add(new Vector3(-0.3004f, -0.9466f, 0.1174f));
            _rotationOffsets.Add(new Vector3(-0.8816f, 0.3225f, 0.3447f));

            //keypoints:
            HandCenter  = new ManagedKeypoint();
            WristCenter = new ManagedKeypoint();

            //fingers:
            Thumb  = new ManagedFinger(_managedHand.Hand, _thumbMCP, _thumbPIP, _thumbTip);
            Index  = new ManagedFinger(_managedHand.Hand, _indexMCP, _indexPIP, _indexTip);
            Middle = new ManagedFinger(_managedHand.Hand, _middleMCP, _middlePIP, _middleTip);
            Ring   = new ManagedFinger(_managedHand.Hand, _ringMCP, _ringTip);
            Pinky  = new ManagedFinger(_managedHand.Hand, _pinkyMCP, _pinkyTip);
        }
        public ManagedFinger GetFinger(FingerType fingerType)
        {
            ManagedFinger finger = null;

            switch (fingerType)
            {
            case FingerType.Thumb:
                finger = Thumb;
                break;

            case FingerType.Index:
                finger = Index;
                break;

            case FingerType.Middle:
                finger = Middle;
                break;

            case FingerType.Ring:
                finger = Ring;
                break;

            case FingerType.Pinky:
                finger = Pinky;
                break;
            }

            return(finger);
        }
Пример #3
0
        private void DrawDigit(string fingerName, ManagedFinger finger, Color colorA, Color colorB)
        {
            fingerName = Name(fingerName);
            Lines.DrawLine(fingerName, colorA, colorB, .0005f, finger.PointLocationsFiltered);

            if (_managedHand.Visible && finger.IsVisible)
            {
                Lines.SetVisibility(fingerName, true);
            }
            else
            {
                Lines.SetVisibility(fingerName, false);
            }
        }
Пример #4
0
        private string Name(ManagedFinger finger)
        {
            switch (finger.FingerType)
            {
            case FingerType.Thumb:
                return(Name("thumb"));

            case FingerType.Index:
                return(Name("index"));

            case FingerType.Middle:
                return(Name("middle"));

            case FingerType.Ring:
                return(Name("ring"));

            case FingerType.Pinky:
                return(Name("pinky"));
            }
            return("");
        }
Пример #5
0
 //Event Handlers:
 private void HandleFingerVisibilityChanged(ManagedFinger finger, bool visible)
 {
     Lines.SetVisibility(Name(finger), visible);
 }