Beispiel #1
0
 private float GetJointSplitAngle(UnityHandController hand, UnityHandRepresentation rep, int finger, int joint)
 {
     if (isReady)
     {
         var value       = hand.GetCurrentFingerRotationInfo().Fingers[finger].Split.Value;
         var handProfile = profileMgr.FindProfile(rep.GraphicsHandModel.Hand);
         if (handProfile != null)
         {
             var angle = handProfile.Fingers[finger].Joints[joint].SplitAngleExtreme * value;
             return(angle);
         }
     }
     return(0);
 }
        private void DisplayHandRotationNormalized(bool isRight)
        {
            string handLabel = isRight ? "Right Hand" : "Left Hand";

            EditorGUILayout.LabelField(handLabel);
            EditorGUI.indentLevel++;
            if (_dexmoController.HandControllerPairs == null ||
                _dexmoController.HandControllerPairs.Count == 0)
            {
                EditorGUILayout.LabelField(handLabel + " is not initialized.");
            }
            else
            {
                UnityHandController handController = isRight
                    ? _dexmoController.HandControllerPairs[0].Right
                    : _dexmoController.HandControllerPairs[0].Left;
                //if (!handController.Active)
                //{
                //    EditorGUILayout.LabelField(handLabel + " is not active.");
                //}
                //else
                {
                    IHandRotationNormalized handRotation =
                        handController.GetCurrentFingerRotationInfo();
                    int n = handRotation.Fingers.Length;
                    for (int i = 0; i < n; i++)
                    {
                        IFingerRotationNormalized fingerRotation =
                            handRotation.Fingers[i];
                        FingerType fingerType = (FingerType)i;
                        EditorGUILayout.LabelField(fingerType.ToString());
                        DisplayFingerRotationNormalized(fingerRotation);
                    }
                }
            }
            EditorGUI.indentLevel--;
        }