Skip to main content
1 of 4
AzulShiva
  • 679
  • 3
  • 15
  • 38

Unity: Lerping using Time.deltaTime

To my Understanding a Lerp function Interpolates between two values (a and b) using a third value (t) between 0 and 1. At t = 0, the value a is returned, at t = 1, the value b is returned. At 0.5 the inbetween of a and b is returned.

(The following picture is a Slerp)

enter image description here

I have been browsing the forums and on this answer I found the following line of code: transform.rotation = Quaternion.Slerp(transform.rotation, _lookRotation, Time.deltaTime);

I thought to myself, "what a fool, he has no idea" but since it had 40+ upvotes I gave it a try and sure enough, it worked!

float t = Time.deltaTime;
transform.rotation = Quaternion.Slerp(transform.rotation, toRotation, tt);
Debug.Log(t);

I got random values between 0.01 and 0.02 for t. Shouldn't the function interpolate accordingly? Why do these values stack? What is it about lerp that I do not understand?

AzulShiva
  • 679
  • 3
  • 15
  • 38