Skip to content

Commit

Permalink
Rename input to velocity
Browse files Browse the repository at this point in the history
  • Loading branch information
selimnahimi committed Sep 8, 2023
1 parent 4e10eca commit 6f2bba7
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions code/pawn/PawnController.Util.cs
Original file line number Diff line number Diff line change
Expand Up @@ -263,12 +263,12 @@ Entity CheckForGround()
return trace.Entity;
}

Vector3 ApplyFriction( Vector3 input, float frictionAmount )
Vector3 ApplyFriction( Vector3 velocity, float frictionAmount )
{
float StopSpeed = 100.0f;

var speed = input.Length;
if ( speed < 0.1f ) return input;
var speed = velocity.Length;
if ( speed < 0.1f ) return velocity;

// Bleed off some speed, but if we have less than the bleed
// threshold, bleed the threshold amount.
Expand All @@ -280,12 +280,12 @@ Vector3 ApplyFriction( Vector3 input, float frictionAmount )
// scale the velocity
float newspeed = speed - drop;
if ( newspeed < 0 ) newspeed = 0;
if ( newspeed == speed ) return input;
if ( newspeed == speed ) return velocity;

newspeed /= speed;
input *= newspeed;
velocity *= newspeed;

return input;
return velocity;
}

void DoMovement( Vector3 moveVector )
Expand All @@ -294,20 +294,20 @@ void DoMovement( Vector3 moveVector )
Entity.Velocity = ApplyFriction( Entity.Velocity, Friction );
}

Vector3 Accelerate( Vector3 input, Vector3 wishdir, float wishspeed, float speedLimit, float acceleration )
Vector3 Accelerate( Vector3 velocity, Vector3 wishdir, float wishspeed, float speedLimit, float acceleration )
{
if ( speedLimit > 0 && wishspeed > speedLimit )
wishspeed = speedLimit;

input = input.LerpTo( wishdir * wishspeed, Time.Delta * 45f * acceleration );
velocity = velocity.LerpTo( wishdir * wishspeed, Time.Delta * 45f * acceleration );

return input;
return velocity;
}

Vector3 ApplyJump( Vector3 input, string jumpType )
Vector3 ApplyJump( Vector3 velocity, string jumpType )
{
AddEvent( jumpType );
return input.WithZ(0) + Vector3.Up * JumpSpeed;
return velocity.WithZ(0) + Vector3.Up * JumpSpeed;
}

void UpdateMoveHelper( Entity groundEntity )
Expand Down

0 comments on commit 6f2bba7

Please sign in to comment.