Nan solutions

Hi everybody, here are my solutions to the NaN problem:

  • Solution 1: do nothing if period == 0
if (period != 0)
        {
            CalculateMovementFactor();
        }
  • Solution 2: do nothing if movementFactor is a Nan
if (!float.IsNaN(movementFactor))
        {
            Vector3 offset = movementVector * movementFactor;
            transform.position = startingPos + offset;
        }

Privacy & Terms