Relative motion script always moves from the origin

I’ve tried making a script that moves the object smoothly by some amount relatively from its present location.

The purpose of this code is that my program is designed in a series of cells so the camera needs to move a certain amount of units in one axis smoothly, making the world look continuous.

The problem is that the code moves the object back to the origin whenever it is called.

The code can be found here Cam

I thought it was the initialization code but the documentation says Awake() is called only once, and the arguments going in to Mathf.Lerp() checked out when I used print() to check. Now I’m all out of ideas.

So in your movement code you are multiplying a Lerp by i, but that starts at 0, just remove it and you will be at least one step closer!

transform.position.x=motionSpeed*Mathf.Lerp(initialPoint, finalPoint, i);