Пример #1
0
        void DrawRigidbodySettings()
        {
            EditorGUILayout.PropertyField(serializedObject.FindProperty("useGravity"));
            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("totalMass"),
                                           new GUIContent("Total Mass", "The total mass of the Rigidbody. It will be distributed according to the assigned WeightDistribution."),
                                           0, Mathf.Infinity);
            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("drag"), 0, Mathf.Infinity);
            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("angularDrag"), 0, Mathf.Infinity);

            EditorGUILayout.PropertyField(serializedObject.FindProperty("material"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("interpolation"));
            EditorGUILayout.PropertyField(serializedObject.FindProperty("collisionDetectionMode"));

            EditorGUILayout.IntSlider(serializedObject.FindProperty("solverIterations"), 6, 40,
                                      new GUIContent("Joint Solver Iterations",
                                                     "The higher the iterations, the more accurate the Joint behaviour will be, at the cost of lower performance."));
        }
Пример #2
0
        void DrawLimitProperties()
        {
            EditorGUILayout.Slider(serializedObject.FindProperty("limitBounciness"), 0, 1);

            EditorGUILayout.Slider(serializedObject.FindProperty("limitContactDistanceFactor"), 0, 1,
                                   new GUIContent("Limit Contact Distance Factor", "How far the joint can \"see\" the limit, expressed as a factor of the total distance of the limit." +
                                                  "1 means everywhere. 0.5 means halfwat through the joint. 0 lets PhysX pick the distance. \n" +
                                                  "Increase this value to decrease jittering, at the cost of performance.")
                                   );

            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("limitSpring"),
                                           new GUIContent("Limit Spring",
                                                          "The strength of the springs that enforce the joint limits. The value for each specific Joint is scaled by the mass of the attached Rigidbody."),
                                           0, Mathf.Infinity);

            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("limitSpringDamping"),
                                           new GUIContent("Limit Spring Damping",
                                                          "The damping of the springs that enforce the joint limits. The value for each specific Joint is scaled by the mass of the attached Rigidbody."),
                                           0, Mathf.Infinity);
        }
Пример #3
0
        public override void OnInspectorGUI()
        {
            bindingDefinition?.serializedObject.Update();

            DrawBindingsField();

            ExtraNaughtyEditorGUILayout.Header("Animation Parameters");
            DrawProfileField();
            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("_profileTransitionLength"),
                                           new GUIContent("Profile Transition Length",
                                                          "When changing profile, a blend transition will be done. This is the length of that transition."),
                                           0, Mathf.Infinity);

            ExtraNaughtyEditorGUILayout.Header("Master controls");
            NonLinearSliderDrawer.Draw_Layout(serializedObject.FindProperty("_masterAlpha"), 0, 1, QuadraticSliderDrawer.GetQuadraticFunction(2),
                                              new GUIContent("Master Alpha", "The profile's alpha values will be multiplied by this amount. \n" +
                                                             "Alpha defines the stiffness with which the ragdoll matches the animation. " +
                                                             "High values will instantly get to the target pose, while low values will treat the target pose more like a suggestion."));

            EditorGUILayout.Slider(serializedObject.FindProperty("_masterDampingRatio"), 0, 1,
                                   new GUIContent("Master Damping Ratio", "The profile's damping ratio values will be multiplied by this amount. \n" +
                                                  "A damping ratio of 1 will get to the target pose perfectly, with no overshooting. " +
                                                  "Lower values will overshoot the target pose."));

            EditorGUILayout.PropertyField(serializedObject.FindProperty("forceTargetPose"));
            ExtraNaughtyEditorGUILayout.Header("Debug Features (Editor Only)");
            if (serializedObject.isEditingMultipleObjects)
            {
                NaughtyEditorGUI.HelpBox_Layout("Multiple object editing isn't supported for debug features.", MessageType.Info, logToConsole: false);
            }
            else
            {
                using (new GUILayout.VerticalScope(GUI.skin.box))
                {
                    DoHideMeshField();
                }
            }

            serializedObject.ApplyModifiedProperties();
        }
Пример #4
0
        protected override void DrawInspector()
        {
            mustRebuildOverrides = false;

            DrawDefinitionField();
            if (HasDefinition)
            {
                BoneProfileOverrideDrawer.SetCurrentRagdollDefinition(Definition);
            }
            else
            {
                NaughtyEditorGUI.HelpBox_Layout("You can assign a definition to be able to override individual bones.", MessageType.Info);
            }

            NaughtyEditorGUI.DrawHeader("Position Matching");
            NonLinearSliderDrawer.Draw_Layout(serializedObject.FindProperty("globalPositionAlpha"), 0, 1, NonLinearSliderDrawer.Function.Quadratic(2),
                                              new GUIContent("Global Alpha",
                                                             "Alpha defines the stiffness with which the ragdoll matches the animation. " +
                                                             "High values will instantly get to the target position, while low values will treat the target position more like a suggestion."));
            EditorGUILayout.Slider(serializedObject.FindProperty("globalPositionDampingRatio"), 0, 1,
                                   new GUIContent("Global Position Damping Ratio", "A damping ratio of 1 will get to the target position perfectly, with no overshooting. " +
                                                  "Lower values will overshoot the target position."));

            EditorGUI.BeginChangeCheck();
            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("globalMaxLinearAcceleration"), 0, Mathf.Infinity);
            if (EditorGUI.EndChangeCheck())
            {
                mustRebuildOverrides = true;
            }

            EditorGUILayout.Space();

            if (HasValidDefinition)
            {
                DrawOverrideList(positionMatchingOverridesList);
            }
            WarnAgainstUnstablePositionMatchingParameters();


            NaughtyEditorGUI.DrawHeader("Rotation Matching");
            EditorGUILayout.PropertyField(serializedObject.FindProperty("matchRootRotation"));
            NonLinearSliderDrawer.Draw_Layout(serializedObject.FindProperty("globalRotationAlpha"), 0, 1, NonLinearSliderDrawer.Function.Quadratic(2),
                                              new GUIContent("Global Rotation Alpha",
                                                             "Alpha defines the stiffness with which the ragdoll matches the animation. " +
                                                             "High values will instantly get to the target rotation, while low values will treat the target rotation more like a suggestion."));

            EditorGUILayout.Slider(serializedObject.FindProperty("globalRotationDampingRatio"), 0, 1,
                                   new GUIContent("Global Rotation Damping Ratio", "A damping ratio of 1 will get to the target rotation perfectly, with no overshooting. " +
                                                  "Lower values will overshoot the target rotation."));

            EditorGUI.BeginChangeCheck();
            ClampedFloatDrawer.Draw_Layout(serializedObject.FindProperty("globalMaxAngularAcceleration"), 0, Mathf.Infinity);
            if (EditorGUI.EndChangeCheck())
            {
                mustRebuildOverrides = true;
            }

            EditorGUILayout.Space();

            if (HasValidDefinition)
            {
                DrawOverrideList(rotationMatchingOverridesList);
            }
            WarnAgainstPositionWithoutRotation();

            BoneProfileOverrideDrawer.SetCurrentRagdollDefinition(null);
        }