Esempio n. 1
0
        protected virtual void RotateFingers(ApolloHandData handData)
        {
            for (int fingerNum = 0; fingerNum < FingerControllers.Count; fingerNum++) // Go over all fingerData, including the thumb.
            {
                for (int jointNum = 1; jointNum <= 3; jointNum++)                     // CMC to IP for the thumb, MCP to DIP for the other fingerData.
                {
                    ApolloHandData.FingerName convertedFingerNum = (ApolloHandData.FingerName)fingerNum;

                    try
                    {
                        FingerControllers[convertedFingerNum].RotatePhalange(jointNum, handData.fingers[fingerNum].joints[jointNum]);
                    }
                    catch (NullReferenceException)
                    {
                        Debug.LogError($"FingerControllers not found {convertedFingerNum} / {jointNum} / {fingerNum}");
                    }
                }
            }
        }
Esempio n. 2
0
        protected virtual Finger CreateFinger(ApolloHandData.FingerName fingerName)
        {
            try
            {
                Finger newFinger = FingerTransforms[(int)fingerName][1].gameObject.AddComponent <Finger>();

                newFinger.Index      = fingerName;
                newFinger.DeviceType = DeviceType;
                newFinger.PhalangesGameObjects[1] = FingerTransforms[(int)fingerName][1].gameObject;
                newFinger.PhalangesGameObjects[2] = FingerTransforms[(int)fingerName][2].gameObject;
                newFinger.PhalangesGameObjects[3] = FingerTransforms[(int)fingerName][3].gameObject;
                newFinger.Hand = this;

                return(newFinger);
            }
            catch (NullReferenceException)
            {
                Debug.Log("Create Finger exception");
            }

            return(null);
        }
Esempio n. 3
0
        public FingerRig GetFingerRig(ApolloHandData.FingerName finger)
        {
            switch (finger)
            {
            case ApolloHandData.FingerName.Thumb:
                return(Thumb);

            case ApolloHandData.FingerName.Index:
                return(Index);

            case ApolloHandData.FingerName.Middle:
                return(Middle);

            case ApolloHandData.FingerName.Ring:
                return(Ring);

            case ApolloHandData.FingerName.Pinky:
                return(Pinky);

            default:
                throw new ArgumentOutOfRangeException("finger", finger, null);
            }
        }
Esempio n. 4
0
        public Transform GetFingerTransform(device_type_t deviceType, ApolloHandData.FingerName finger, PhalangeType phalange)
        {
            HandRig hand = GetHand(deviceType);

            if (hand == null)
            {
                throw new ArgumentOutOfRangeException("phalange", phalange, null);
            }

            switch (phalange)
            {
            case PhalangeType.Proximal:
                return(hand.GetFingerRig(finger).Proximal);

            case PhalangeType.Intermedial:
                return(hand.GetFingerRig(finger).Intermedial);

            case PhalangeType.Distal:
                return(hand.GetFingerRig(finger).Distal);

            default:
                throw new ArgumentOutOfRangeException("phalange", phalange, null);
            }
        }