Assets/Scripts/Player/Movement/PlayerPhysics.cs
/// <summary>
/// clamps the speed vector coordinates under max_x and max_y
/// </summary>
/// <param name="max_x">max speed horizontal</param>
/// <param name="max_y">max speed vertical</param>
clamps the speed vector coordinates under max_x and max_y
clamps the speed vector coordinates under max_x and max_y
private void ClampSpeed(float max_x, float max_y)
        {
            targetSpeed.x = Mathf.Sign(targetSpeed.x) * Mathf.Clamp(Mathf.Abs(targetSpeed.x), 0, max_x);
            targetSpeed.y = Mathf.Sign(targetSpeed.y) * Mathf.Clamp(Mathf.Abs(targetSpeed.y), 0, max_y);
        }
private void ClampSpeed ( float max_x , float max_y ) { targetSpeed . x = Mathf . Sign ( targetSpeed . x ) * Mathf . Clamp ( Mathf . Abs ( targetSpeed . x ) , 0 , max_x ) ; targetSpeed . y = Mathf . Sign ( targetSpeed . y ) * Mathf . Clamp ( Mathf . Abs ( targetSpeed . y ) , 0 , max_y ) ; }
clamps the speed vector coordinates under max_x and max_y
clamps the speed vector coordinates under max_x and max_y
max_x
float
max speed horizontal
max speed horizontal
max_y
float
max speed vertical
max speed vertical