예제 #1
0
        public override void OnInspectorGUI()
        {
            urdfJoint = (UrdfJoint)target;

            GUILayout.Space(5);

            UrdfJoint.JointTypes newJointType = urdfJoint.JointType;

            EditorGUILayout.BeginVertical("HelpBox");
            newJointType = (UrdfJoint.JointTypes)EditorGUILayout.EnumPopup(
                "Type of joint", newJointType);
            if (newJointType != urdfJoint.JointType)
            {
                if (EditorUtility.DisplayDialog("Confirm joint type change",
                                                "Are you sure you want to change the joint type? This will erase all information currently stored in the joint.",
                                                "Continue", "Cancel"))
                {
                    UrdfJoint.ChangeJointType(urdfJoint.gameObject, newJointType);
                }
            }
            EditorGUILayout.EndVertical();

            showDetails = EditorGUILayout.Foldout(showDetails, "Joint URDF Configuration", true);
            if (showDetails)
            {
                urdfJoint.jointName = EditorGUILayout.TextField("Name", urdfJoint.jointName);

                if (urdfJoint.JointType != UrdfJoint.JointTypes.Fixed)
                {
                    GUILayout.BeginVertical("HelpBox");
                }
                switch (urdfJoint.JointType)
                {
                case UrdfJoint.JointTypes.Fixed:
                    break;

                case UrdfJoint.JointTypes.Continuous:
                    DisplayDynamicsMessage("HingeJoint > Spring > Damper (for damping) and Spring (for friction)");
                    DisplayAxisMessage("HingeJoint > Axis");
                    break;

                case UrdfJoint.JointTypes.Revolute:
                    DisplayDynamicsMessage("HingeJoint > Spring > Damper (for damping) and Spring (for friction)");
                    DisplayAxisMessage("HingeJoint > Axis");
                    DisplayRequiredLimitMessage("Hinge Joint Limits Manager > Large Angle Limit  / Max");
                    break;

                case UrdfJoint.JointTypes.Floating:
                    DisplayDynamicsMessage("ConfigurableJoint > xDrive > Position Damper (for Damping) and Position Spring (for friction)");
                    break;

                case UrdfJoint.JointTypes.Prismatic:
                    DisplayDynamicsMessage("ConfigurableJoint > xDrive > Position Damper (for Damping) and Position Spring (for friction)");
                    DisplayAxisMessage("ConfigurableJoint > Axis");
                    DisplayRequiredLimitMessage("Prismatic Joint Limits Manager > Position Limit Min / Max");
                    break;

                case UrdfJoint.JointTypes.Planar:
                    DisplayDynamicsMessage("ConfigurableJoint > xDrive > Position Damper (for Damping) and Position Spring (for friction)");
                    DisplayAxisMessage("ConfigurableJoint > Axis and Secondary Axis");
                    DisplayRequiredLimitMessage("ConfigurableJoint > Linear Limit > Limit");
                    break;
                }

                if (urdfJoint.JointType != UrdfJoint.JointTypes.Fixed)
                {
                    GUILayout.EndVertical();
                }
            }
        }