Пример #1
0
        private void InspectJoint(BioJoint joint)
        {
            Undo.RecordObject(joint, joint.name);

            SetGUIColor(Color13);
            using (new EditorGUILayout.VerticalScope("Box")) {
                SetGUIColor(Color5);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                EditorGUILayout.HelpBox("                    Joint                    ", MessageType.None);
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();

                SetGUIColor(Color1);
                joint.enabled = EditorGUILayout.Toggle("Enabled", joint.enabled);

                SetGUIColor(Color4);
                EditorGUILayout.HelpBox("Geometry", MessageType.None);
                SetGUIColor(Color1);
                joint.JointType = (JointType)EditorGUILayout.EnumPopup("Joint Type", joint.JointType);
                SetGUIColor(Color1);
                joint.SetAnchor(EditorGUILayout.Vector3Field("Anchor", joint.GetAnchor()));
                SetGUIColor(Color1);
                joint.SetOrientation(EditorGUILayout.Vector3Field("Orientation", joint.GetOrientation()));
                SetGUIColor(Color4);
                EditorGUILayout.HelpBox("Default Frame", MessageType.None);
                SetGUIColor(Color1);
                Vector3 defaultPosition = EditorGUILayout.Vector3Field("Position", joint.GetDefaultPosition());
                SetGUIColor(Color1);
                Quaternion defaultRotation = Quaternion.Euler(EditorGUILayout.Vector3Field("Rotation", joint.GetDefaultRotation().eulerAngles));
                joint.SetDefaultFrame(defaultPosition, defaultRotation);

                InspectMotion(joint.X, "     X Motion     ");
                InspectMotion(joint.Y, "     Y Motion     ");
                InspectMotion(joint.Z, "     Z Motion     ");

                GUI.skin.button.alignment = TextAnchor.MiddleCenter;
                SetGUIColor(Color7);
                GUILayout.BeginHorizontal();
                GUILayout.FlexibleSpace();
                if (GUILayout.Button("Remove", GUILayout.Width(100f)))
                {
                    joint.Remove();
                }
                GUILayout.FlexibleSpace();
                GUILayout.EndHorizontal();
            }

            if (joint != null)
            {
                joint.PrecaptureAnimation();
                joint.PostcaptureAnimation();
                joint.UpdateData();
                joint.ProcessMotion();
                EditorUtility.SetDirty(joint);
            }
        }
Пример #2
0
 private void DrawJoint(BioJoint joint, bool final)
 {
     if (!final)
     {
         DoF += joint.GetDoF();
     }
     //DrawDottedLine(joint.Segment.Transform.position, joint.GetAnchorInWorldSpace(), 5f, Color.magenta);
     DrawCube(joint.GetAnchorInWorldSpace(), joint.Segment.Transform.rotation * Quaternion.Euler(joint.GetOrientation()), 0.025f, Color.magenta);
     DrawMotion(joint.X, Color.red, final);
     DrawMotion(joint.Y, Color.green, final);
     DrawMotion(joint.Z, Color.blue, final);
 }
Пример #3
0
 public BioJoint AddJoint()
 {
     if (Joint != null)
     {
         Debug.Log("The segment already has a joint.");
     }
     else
     {
         Joint = Utility.AddBioJoint(this);
         Character.Refresh();
     }
     return(Joint);
 }
Пример #4
0
            public bool[] ObjectiveImpacts;                                     //Boolean values to represent which objective indices in the whole kinematic tree are affected (TODO: Refactor this)

            //Setup for the node
            public Node(Model model, Node parent, BioSegment segment)
            {
                Model  = model;
                Parent = parent;
                if (Parent != null)
                {
                    Parent.AddChild(this);
                }
                Transform = segment.Transform;
                Joint     = segment.Joint;

                List <Transform> reverseChain = new List <Transform>();

                reverseChain.Add(Transform);
                Node p = parent;

                while (p != null)
                {
                    reverseChain.Add(p.Transform);
                    p = p.Parent;
                }
                reverseChain.Reverse();
                Chain = reverseChain.ToArray();
            }
Пример #5
0
 public Motion(BioJoint joint, Vector3 axis)
 {
     Joint = joint;
     Axis  = axis;
 }