Skip to content

Commit

Permalink
Use a smaller movement epsilon when checking if no movement should ha…
Browse files Browse the repository at this point in the history
…ppen.
  • Loading branch information
MelvMay-Unity committed Feb 8, 2021
1 parent 2232308 commit c72135d
Showing 1 changed file with 2 additions and 3 deletions.
Expand Up @@ -70,10 +70,8 @@ void Update()

void FixedUpdate()
{
const float Epsilon = 0.005f;

// Don't perform any work if no movement is required.
if (m_Movement.sqrMagnitude <= Epsilon)
if (m_Movement.sqrMagnitude <= Mathf.Epsilon)
return;

// Grab the input movement unit direction.
Expand All @@ -89,6 +87,7 @@ void FixedUpdate()
var startPosition = m_Rigidbody.position;

// Iterate up to a capped iteration limit or until we have no distance to move or we've clamped the direction of motion to zero.
const float Epsilon = 0.005f;
while(
maxIterations-- > 0 &&
distanceRemaining > Epsilon &&
Expand Down

0 comments on commit c72135d

Please sign in to comment.