Ejemplo n.º 1
0
        private void FingerConfigurationInspector(HandTarget handTarget, FingersTarget.TargetedFinger digit, int fingerIndex, string label)
        {
            Transform proximalBone = (Transform)EditorGUILayout.ObjectField(label, digit.proximal.bone.transform, typeof(Transform), true);

            if (proximalBone == null || proximalBone != digit.proximal.bone.transform)
            {
                if (proximalBone == null)
                {
                    proximalBone = FingersTarget.GetFingerBone(handTarget, (Finger)fingerIndex, Humanoid.Tracking.FingerBones.Proximal);
                }
                if (proximalBone != null && proximalBone.childCount == 1)
                {
                    digit.intermediate.bone.transform = proximalBone.GetChild(0);
                    if (digit.intermediate.bone.transform != null && digit.intermediate.bone.transform.childCount == 1)
                    {
                        digit.distal.bone.transform = digit.intermediate.bone.transform.GetChild(0);
                    }
                    else
                    {
                        digit.distal.bone.transform = null;
                    }
                }
                else
                {
                    digit.intermediate.bone.transform = null;
                }
            }
            digit.proximal.bone.transform = proximalBone;
        }
Ejemplo n.º 2
0
        public static void ReceiveAvatarHandPose(this IHumanoidNetworking networking, HandTarget handTarget)
        {
            float thumbCurl  = networking.ReceiveFloat();
            float indexCurl  = networking.ReceiveFloat();
            float middleCurl = networking.ReceiveFloat();
            float ringCurl   = networking.ReceiveFloat();
            float littleCurl = networking.ReceiveFloat();

            if (handTarget != null)
            {
                FingersTarget fingersTarget = handTarget.fingers;

                fingersTarget.thumb.curl  = thumbCurl;
                fingersTarget.index.curl  = indexCurl;
                fingersTarget.middle.curl = middleCurl;
                fingersTarget.ring.curl   = ringCurl;
                fingersTarget.little.curl = littleCurl;
                bool syncFingerSwing = networking.ReceiveBool();
                if (syncFingerSwing)
                {
                    fingersTarget.thumb.swing  = networking.ReceiveFloat();
                    fingersTarget.index.swing  = networking.ReceiveFloat();
                    fingersTarget.middle.swing = networking.ReceiveFloat();
                    fingersTarget.ring.swing   = networking.ReceiveFloat();
                    fingersTarget.little.swing = networking.ReceiveFloat();
                }
            }
        }
Ejemplo n.º 3
0
            public void Init(FingersTarget _fingers)
            {
                fingers = _fingers;

                proximal.parent = fingers.handTarget.hand;

                //metaCarpal.nextBone = proximal;
                proximal.nextBone     = intermediate;
                intermediate.nextBone = distal;
            }
Ejemplo n.º 4
0
            public TargetedFinger(FingersTarget fingers)
            {
                this.fingers = fingers;

                //metaCarpal = new TargetedPhalanges(this, proximal);
                proximal     = new TargetedPhalanges(this, intermediate);
                intermediate = new TargetedPhalanges(this, distal);
                distal       = new TargetedPhalanges(this, null);

                //proximal.parent = metaCarpal;
                proximal.parent     = this.fingers.handTarget.hand;
                intermediate.parent = proximal;
                distal.parent       = intermediate;
            }
Ejemplo n.º 5
0
 private void SetCurl(FingersTarget fingers, float curlValue)
 {
     if (this == fingers.thumb)
     {
         SetThumb1Rotation(curlValue);
         SetThumb2Rotation(curlValue);
         SetThumb3Rotation(curlValue);
     }
     else
     {
         SetFinger1Rotation(curlValue);
         SetFinger2Rotation(curlValue);
         SetFinger3Rotation(curlValue);
     }
 }
        private void UpdateFingerMovementsSide(FingersTarget fingers, ControllerSide controllerSide)
        {
            float thumbCurl = Mathf.Max(controllerSide.trigger2, controllerSide.trigger1);

            fingers.thumb.curl = !controllerSide.stickTouch ? -0.5F : thumbCurl;

            float indexValue = controllerSide.trigger1;

            SetFingerCurl(fingers.index, indexValue);

            float fingersValue = Mathf.Max(controllerSide.trigger2, controllerSide.trigger1);

            SetFingerCurl(fingers.middle, fingersValue);
            SetFingerCurl(fingers.ring, fingersValue);
            SetFingerCurl(fingers.little, fingersValue);
        }
Ejemplo n.º 7
0
        public static void SendAvatarHandPose(this IHumanoidNetworking networking, HandTarget handTarget)
        {
            networking.Send(handTarget != null);
            if (handTarget != null)
            {
                FingersTarget fingersTarget = handTarget.fingers;

                networking.Send(fingersTarget.thumb.curl);
                networking.Send(fingersTarget.index.curl);
                networking.Send(fingersTarget.middle.curl);
                networking.Send(fingersTarget.ring.curl);
                networking.Send(fingersTarget.little.curl);

                networking.Send(syncFingerSwing);
                if (syncFingerSwing)
                {
                    networking.Send(fingersTarget.thumb.swing);
                    networking.Send(fingersTarget.index.swing);
                    networking.Send(fingersTarget.middle.swing);
                    networking.Send(fingersTarget.ring.swing);
                    networking.Send(fingersTarget.little.swing);
                }
            }
        }
Ejemplo n.º 8
0
 private void InitFingerConfiguration(FingersTarget fingers)
 {
 }