where does movetowards/rotatetowards get the delta time value from?

lerping moves so much along a line from current to target. (current,target,percentage)

with it normally being time.deltatime

movetowards has

movetowards(current,target,max radians,max magnitude)

ok i see where the max is but what about the less than max. I want to lerp/slerp from one target to another but i want to clamp the amount of force applied so bigger things still take longer to speed up and slow down that smaller things.

So i want to use move/rotatetowards and give it a max however I don’t see how it could be less than the max.

I want a slerp with a max value not a slerp with a constant speed value is this a slerp with a constant value?

MoveTowards() has a maximum distance it can move as the past parameter, so each time you call it, that is the maximum distance. When you multiply that number by Time.deltaTime, the calculation becomes a speed measured in units per second. If I have two object 10 units apart, and I use the the following line of code to move…

transform.position = Vector3.MoveTowards(transform.position, destPosition, 2.0f * Time.deltaTime); 

…it will take 5 seconds to travel the 10 units. Replace “2.0f” by a variable, and you can control the speed your object moves.

Lerp() is harder, not because the concept is harder, but because everyone uses it in a “strange” way. If MoveTowards() is about speed, Lerp() is about time. Used “correctly” it will move an object from one position to another in a fixed amount of time. Typically to use it “correctly” you would implement some sort of timer and call it like:

transform.position = Lerp(originalPosition, destinationPosition, elapseTimer / totalTime);

And the object would move from the two positions in the same about of time no matter how far apart they were. Note the use of the originalPosition rather than transform.position, and notice deltaTimes does not appear in the function call.

But here is how 99.9% of the examples on UnityAnswers are written using Lerp():

transform.position = Lerp(transform.position, destinationPosition, speed * Time.deltaTime);  

What this does is take approximately the same percentage move from the current position to the destination each frame. Since the distance is shorter, the same percentage moves ever smaller distances. The result is the nice easing at the end of the move.