@@ -92,10 +92,10 @@ public override void OnInspectorGUI()
92
92
if ( GUILayout . Button ( "Generate from Elasticity & Falloff" , GUILayout . Width ( 220 ) ) )
93
93
{
94
94
ElasticityOverVelocity . animationCurveValue . keys . Initialize ( ) ;
95
- Keyframe [ ] keyframes = new Keyframe [ 64 ] ;
95
+ Keyframe [ ] keyframes = new Keyframe [ 8 ] ;
96
96
for ( int i = 0 ; i < keyframes . Length ; i ++ )
97
97
{
98
- keyframes [ i ] = new Keyframe ( i , Elasticity . floatValue / ( 1.0f + ElasticityFalloff . floatValue * i / 18.53f ) ) ;
98
+ keyframes [ i ] = new Keyframe ( i * 8 , Elasticity . floatValue / ( 1.0f + ElasticityFalloff . floatValue * i * 8 / 18.53f ) ) ;
99
99
}
100
100
var tempcurve = new AnimationCurve ( keyframes ) ;
101
101
for ( int i = 0 ; i < keyframes . Length ; i ++ )
@@ -163,13 +163,17 @@ public override void OnInspectorGUI()
163
163
EditorGUI . indentLevel -- ;
164
164
EditorGUI . indentLevel ++ ;
165
165
GUILayout . Label ( "Friction" ) ;
166
+ GUI . enabled = ( FrictionOverVelocity . animationCurveValue . keys . Length == 0 ) ;
166
167
EditorGUILayout . PropertyField ( Friction , true ) ;
168
+ GUI . enabled = true ;
167
169
EditorGUILayout . PropertyField ( FrictionOverVelocity , new GUIContent ( "Friction / Velocity" ) , true ) ;
168
170
GUILayout . BeginHorizontal ( ) ;
169
171
GUILayout . FlexibleSpace ( ) ;
170
172
if ( GUILayout . Button ( "Clear (don't use)" , GUILayout . Width ( 220 ) ) )
171
173
{
172
-
174
+ FrictionOverVelocity . animationCurveValue . keys . Initialize ( ) ;
175
+ FrictionOverVelocity . animationCurveValue = new AnimationCurve ( ) ;
176
+ FrictionOverVelocity . serializedObject . ApplyModifiedProperties ( ) ;
173
177
}
174
178
GUILayout . EndHorizontal ( ) ;
175
179
/*
0 commit comments