Answers for "can someone explain how using Time.deltaTime as 't' in a lerp actually works?"
http://answers.unity.com/questions/14288/cansomeoneexplainhowusingtimedeltatimeasti.html
The latest answers for the question "can someone explain how using Time.deltaTime as 't' in a lerp actually works?"Answer by thecommentorlord
http://answers.unity.com/answers/1749577/view.html
I have a potentially simpler solution to that of Eric’s involving the “slow down while approaching target” effect (the curvature is slightly different though):
curPos = Vector3.Lerp(curPos, endPos, 1Pow(2, Time.deltaTime * rate));
curPos = current position
endPos = end position
2 = arbitrary, could be anything larger than 1 (changing it does the same thing as changing the rate).
rate = the rate of the movement  higher value means approaching the end position faster.

Here’s an example to prove this works:
For simplicity let’s just assume the positions are real numbers.
curPos = 1 (at the beginning), endPos = 0, rate = 1.
We’ll track curPos over the duration of 1 time unit to determine the final result in two cases:
**1. If Time.deltaTime = 1:**
in this case the calculation will run 1 time:
curPos = Lerp(1, 0, 1Pow(2, 1*1)) = Lerp(1, 0, 0.5) = 0.5;
so the final result is 0.5.
**2. If Time.deltaTime = 0.25:**
in this case the calculation will run 4 times:
curPos = Lerp(1, 0, 1Pow(2, 0.25*1)) = Lerp(1, 0, 0.16) = 0.84;
curPos = Lerp(0.84, 0, 1Pow(2, 0.25*1)) = Lerp(0.84, 0, 0.16) = 0.705;
curPos = Lerp(0.705, 0, 1Pow(2, 0.25*1)) = Lerp(0.705, 0, 0.16) = 0.59;
curPos = Lerp(0.59, 0, 1Pow(2, 0.25*1)) = Lerp(0.59, 0, 0.16) = 0.5;
so the final result is still 0.5, regardless of Time.deltaTime’s value.
The reason this works is actually pretty simple.
Going with the previous example, what we actually did was this:
**1. If Time.deltaTime = 1:** curPos = 1*2^(1)
**2. If Time.deltaTime = 0.25:** curPos = 1*2^(0.25) *2^(0.25) *2^(0.25) *2^(0.25) = 1*2^(0.250.250.250.25) = 1*2^(1)
I hope this can help someone.Mon, 20 Jul 2020 10:03:18 GMTthecommentorlordAnswer by astracat111
http://answers.unity.com/answers/1474427/view.html
Hopefully someone reads this part as well because this took me some testing to figure out since I"m such a noob...
If you move an gameObject over frames like this:
currentDistance = (currentFrame / target_Frame);
gameObject_ToMove.transform.position = Vector3.Lerp (startingPosition, targetPosition, currentDistance);
To make it frame independent it's incredibly simple. You just want to add Time.deltaTime onto the end of the current distance like so:
currentDistance = (currentFrame / target_Frame) + (0.01f * Time.deltaTime);
gameObject_ToMove.transform.position = Vector3.Lerp (startingPosition, targetPosition, currentDistance);
The reason I use '0.01f' is because if you just add Time.deltaTime onto the end of your equation alone it will go too fast.Wed, 28 Feb 2018 01:19:16 GMTastracat111Answer by cregox
http://answers.unity.com/answers/581439/view.html
Eric mentioned the FPS can vary and it will throw unexpected high values for `deltaTime`. I think this deserves more attention.
(1)
In practice, when [I was using][3] `Time.deltaTime` and [Quaternion.Lerp][1] (it's actually irrelevant if it's quaternion or vector3 or whatever lerp) I was getting this [nasty looking error][2]:
CompareApproximately (aScalar, 0.0F)
UnityEngine.Quaternion:Lerp(Quaternion, Quaternion, Single)
This is because, eventually the deltaTime would make it bigger than 1, thus clamping to 1 and, in my code, for the 1st frame only, the destination rotation was a very bad `(0, 0, 0, 0);`. The point here is: both the clamping and the bad value were unexpected, resulting into a little hard to debug error. Mostly because it's hard to reproduce.
The true effect was nothing that makes the lerping noticeable. But this is something to consider for point 2:
(2)
As we can see in (1) there is this extra problem with the *trick* as it will not behave the same every time, precisely because the FPS can vary. **But** it's not that easy to reproduce the *trick* also, because it kind of balances out processor speeds and so it's one of the best tricks to make a Lerp work similarly in different machines.
For instance, a much simpler way to achieve the same **ease out** *trick* effect is to just set a `const`:
transform.rotation = Quaternion.Lerp(originalRotation, targetRotation, 0.1f);
But if you run that on a i7 quad core versus on an iPhone, you'll already see the difference.
**tl;dr**
So, **there is in fact a [good use][4] for `Time.detalTime` on lerping**. You just need to be aware of the caveats!
[1]: http://docs.unity3d.com/Documentation/ScriptReference/Quaternion.Lerp.html
[2]: http://forum.unity3d.com/threads/154218QuaternionLerpproblemCompareApproximately(aScalar00F)
[3]: http://answers.unity3d.com/questions/171380/camerarelativefreeorbit.html
[4]: http://wiki.unity3d.com/index.php/MouseOrbitZoomFri, 22 Nov 2013 22:21:10 GMTcregoxAnswer by Ippokratis
http://answers.unity.com/answers/46350/view.html
<p>Another script based on Eric's, that prevents the jag effect. Thanks to Eric for the original script, the idea of rate is very usefull.</p>
<pre><code>var pointA:Vector3;
var pointB:Vector3;
var time:float = 10.0;
private var i:float = 0.0;
private var rate:float = 0.0;
function Update ()
{
MoveObject(this.transform, pointA, pointB, time);
}
function MoveObject (thisTransform : Transform, startPos : Vector3, endPos : Vector3, time : float)
{
rate = 1.0/time;
if (i < 1.0)
{
i += Time.deltaTime * rate;
thisTransform.position = Vector3.Lerp(startPos, endPos, i);
}
}
</code></pre>Sat, 05 Feb 2011 10:30:46 GMTIppokratisAnswer by Eric5h5
http://answers.unity.com/answers/14289/view.html
<p>Time.deltaTime is the time since the last frame. In Lerp, the third parameter is a float between 0 and 1. If it's 0, you get the first parameter in Lerp. If it's 1, you get the second. Therefore, with a statement like</p>
<pre><code>transform.position = Vector3.Lerp(transform.position, target.position, Time.deltaTime);
</code></pre>
<p>in Update, you get a position that's partway between <code>transform.position</code> and <code>target.position</code>, depending on the time difference between the current frame and the last frame.</p>
<p>For example, a Time.deltaTime value of .01 (100fps) would return a value that's a combo of 99% <code>transform.position</code> and 1% <code>target.position</code>. As this is repeated each frame, the <code>transform.position</code>, assuming <code>target.position</code> is stationary, becomes closer and closer to <code>target.position</code> but never <em>quite</em> reaches it. (Unless the framerate drops to 1fps or less, in which case Time.deltaTime would be 1 or greater, so the return value would be 100% <code>target.position</code>.)</p>
<p>Note that this is a "trick" usage of Lerp, which creates a "slow down as you approach the target" effect. It's mathematically incorrect, though, since it will produce results that vary somewhat depending on the framerate. This is better:</p>
<pre><code>function MoveObject (thisTransform : Transform, startPos : Vector3, endPos : Vector3, time : float) : IEnumerator {
var i = 0.0;
var rate = 1.0/time;
while (i < 1.0) {
i += Time.deltaTime * rate;
thisTransform.position = Vector3.Lerp(startPos, endPos, i);
yield;
}
}
</code></pre>
<p>That's a coroutine that moves a transform from <code>startPos</code> to <code>endPos</code> over a given time. This happens as <code>i</code> advances from 0.0 to 1.0, and results in completely linear movement, without the "slowdown" effect.</p>
<p>As for Time.time, consider</p>
<pre><code>transform.position = Vector3.Lerp(startPos, endPos, Time.time);
</code></pre>
<p>in Update. This moves the transform from <code>startPos</code> to <code>endPos</code> as the time advances from 0.0 to 1.0. Once the time is past one second, no further movement will occur since the third parameter in Lerp is clamped between 0 and 1. Obviously this isn't very useful unless you actually only want movement to happen for the first second of gameplay for some reason.</p>Fri, 02 Apr 2010 10:53:33 GMTEric5h5