Unity Notes: Lerping

Andrei Marks · May 17, 2012

Just as a reminder to myself:

  • Color.Lerp Interpolates between colors a and b by t.
  • Mathf.Lerp Interpolates between a and b by t. t is clamped between 0 and 1.
  • Color32.Lerp Interpolates between colors a and b by t.
  • Vector2.Lerp Linearly interpolates between two vectors.
  • Vector3.Lerp Linearly interpolates between two vectors.
  • Vector4.Lerp Linearly interpolates between two vectors.
  • Material.Lerp Interpolate properties between two materials.
  • Quaternion.Lerp Interpolates between from and to by t and normalizes the result afterwards.
  • Mathf.LerpAngle Same as Lerp but makes sure the values interpolate correctly when they wrap around 360 degrees.
  • Vector3.Slerp Spherically interpolates between two vectors.
  • Mathf.InverseLerp Calculates the Lerp parameter between of two values.
  • Mathf.MoveTowards
  • Moves a value current towards target.
  • Vector2.MoveTowards
  • Moves a point current towards target.
  • Vector3.MoveTowards
  • Moves a point current towards target.
  • Vector4.MoveTowards
  • Moves a point current towards target.
  • Mathf.MoveTowardsAngle
  • Same as MoveTowards but makes sure the values interpolate correctly when they wrap around 360 degrees.

Twitter, Facebook