Example #1
0
    public override void OnInspectorGUI()
    {
        B6DOFConstraint hc = (B6DOFConstraint)target;

        EditorGUILayout.HelpBox(B6DOFConstraint.HelpMessage, MessageType.Info);
        BTypedConstraintEditor.DrawTypedConstraint(hc);
        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Limits", EditorStyles.boldLabel);
        hc.linearLimitLower         = EditorGUILayout.Vector3Field("Linear Limit Lower", hc.linearLimitLower);
        hc.linearLimitUpper         = EditorGUILayout.Vector3Field("Linear Limit Upper", hc.linearLimitUpper);
        hc.angularLimitLowerRadians = EditorGUILayout.Vector3Field("Angular Limit Lower (Deg.)", hc.angularLimitLowerRadians * Mathf.Rad2Deg) * Mathf.Deg2Rad;
        hc.angularLimitUpperRadians = EditorGUILayout.Vector3Field("Angular Limit Upper (Deg.)", hc.angularLimitUpperRadians * Mathf.Rad2Deg) * Mathf.Deg2Rad;
        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Motor", EditorStyles.boldLabel);
        hc.motorLinearTargetVelocity = EditorGUILayout.Vector3Field("Motor Linear Target Velocity", hc.motorLinearTargetVelocity);
        hc.motorLinearMaxMotorForce  = EditorGUILayout.Vector3Field("Motor Linear Max Force", hc.motorLinearMaxMotorForce);

        if (GUI.changed)
        {
            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(hc);
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            Repaint();
        }
    }
Example #2
0
    public override void OnInspectorGUI()
    {
        BHingedConstraint hc = (BHingedConstraint)target;

        EditorGUILayout.HelpBox(BHingedConstraint.HelpMessage, MessageType.Info);
        EditorGUILayout.LabelField("Hinge Angle (Deg.)" + hc.GetAngle() * Mathf.Rad2Deg);
        BTypedConstraintEditor.DrawTypedConstraint(hc);

        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Motor", EditorStyles.boldLabel);
        hc.enableMotor = EditorGUILayout.Toggle("Enable Motor", hc.enableMotor);
        hc.targetMotorAngularVelocity = EditorGUILayout.FloatField("Target Motor Angular Velocity (Rad/Sec)", hc.targetMotorAngularVelocity);
        hc.maxMotorImpulse            = EditorGUILayout.FloatField("Max Motor Impulse", hc.maxMotorImpulse);

        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Limits", EditorStyles.boldLabel);
        hc.setLimit              = EditorGUILayout.Toggle("Set Limit", hc.setLimit);
        hc.lowLimitAngleRadians  = EditorGUILayout.FloatField("Low Angle (Deg.)", hc.lowLimitAngleRadians * Mathf.Rad2Deg) * Mathf.Deg2Rad;
        hc.highLimitAngleRadians = EditorGUILayout.FloatField("High Angle (Deg.)", hc.highLimitAngleRadians * Mathf.Rad2Deg) * Mathf.Deg2Rad;
        hc.limitSoftness         = EditorGUILayout.FloatField("Limit Softness", hc.limitSoftness);
        hc.limitBiasFactor       = EditorGUILayout.FloatField("Limit Bias Factor", hc.limitBiasFactor);
        if (GUI.changed)
        {
            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(hc);
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            Repaint();
        }
    }
    public override void OnInspectorGUI()
    {
        BBallSocketConstraint hc = (BBallSocketConstraint)target;

        EditorGUILayout.HelpBox(BBallSocketConstraint.HelpMessage, MessageType.Info);
        BTypedConstraintEditor.DrawTypedConstraint(hc);
        if (GUI.changed)
        {
            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(hc);
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            Repaint();
        }
    }
    public override void OnInspectorGUI()
    {
        BConeTwistConstraint hc = (BConeTwistConstraint)target;

        EditorGUILayout.HelpBox(BConeTwistConstraint.HelpMessage, MessageType.Info);

        BTypedConstraintEditor.DrawTypedConstraint(hc);

        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Limits", EditorStyles.boldLabel);
        hc.swingSpan1Radians = EditorGUILayout.FloatField("Swing Span 1 (Deg.)", hc.swingSpan1Radians * Mathf.Rad2Deg) * Mathf.Deg2Rad;
        hc.swingSpan2Radians = EditorGUILayout.FloatField("Swing Span 2 (Deg.)", hc.swingSpan2Radians * Mathf.Rad2Deg) * Mathf.Deg2Rad;
        hc.twistSpanRadians  = EditorGUILayout.FloatField("Twist Span (Deg.)", hc.twistSpanRadians * Mathf.Rad2Deg) * Mathf.Deg2Rad;
        hc.softness          = EditorGUILayout.FloatField("Softness", hc.softness);
        hc.biasFactor        = EditorGUILayout.FloatField("Bias Factor", hc.biasFactor);
        hc.relaxationFactor  = EditorGUILayout.FloatField("Relaxation Factor", hc.relaxationFactor);
        if (GUI.changed)
        {
            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(hc);
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            Repaint();
        }
    }
    public override void OnInspectorGUI()
    {
        BSliderConstraint hc = (BSliderConstraint)target;

        EditorGUILayout.HelpBox(BSliderConstraint.HelpMessage, MessageType.Info);

        BTypedConstraintEditor.DrawTypedConstraint(hc);

        EditorGUILayout.Separator();
        EditorGUILayout.LabelField("Limits", EditorStyles.boldLabel);
        hc.lowerLinearLimit = EditorGUILayout.FloatField("Lower Linear Limit", hc.lowerLinearLimit);
        hc.upperLinearLimit = EditorGUILayout.FloatField("Upper Linear Limit", hc.upperLinearLimit);

        hc.lowerAngularLimitRadians = EditorGUILayout.FloatField("Lower Angular Limit (Deg.)", hc.lowerAngularLimitRadians * Mathf.Rad2Deg) * Mathf.Deg2Rad;
        hc.upperAngularLimitRadians = EditorGUILayout.FloatField("Upper Angular Limit (Deg.)", hc.upperAngularLimitRadians * Mathf.Rad2Deg) * Mathf.Deg2Rad;

        if (GUI.changed)
        {
            serializedObject.ApplyModifiedProperties();
            EditorUtility.SetDirty(hc);
            EditorSceneManager.MarkSceneDirty(EditorSceneManager.GetActiveScene());
            Repaint();
        }
    }