Vector3.Lerp not completing

I thought this was working for the longest time because I left the time param as 1, which does work. It just does it too fast so I slowed down the step. And now it just isn’t completing the interpolation

function Start () {
initialPos = transform.position;
recoilPos = transform.position - Vector3(-3,0,0);
transform.position = recoilPos;

function Update() {
print(“push”);
transform.position = Vector3.Lerp(recoilPos, initialPos, 0.1);

The object moves maybe 3/10 of the distance and then stops, while “push” continues to print. Push is just to return from recoil, this same issue happens going from initial to recoil also

This is such a simple issue but I’m spending more time than i’d like to thinking about it lol… Usually interpolating is straightforward, I’ve done it tons before

The third argument should be increased over time, so in the first frame its 0, in the second frame 0.1, then 0.2, etc.

What you could do for example is:
Use a variable like ‘lastRecoilTime’ and set it to Time.time when you set the recoil position.

Then in the lerp you can do sth. like

..., (Time.time - lastRecoilTime) / 2); //So it will take 2 seconds to go back to normal.

Ahah! thanks so much I knew it was something simple

I guess for some reason I was thinking it would increase ‘by’ that step every update loop rather than setting it to that % of travel

Turns out in the other instances of interpolation I was handling it differently

Thanks again