Moving Platform Moves instantly.

This is the specific part of the movement in the script,

function movenow(){

yield WaitForSeconds(DelayTime);

transform.position = Vector3.Lerp(position1.transform.position, position2.transform.position, moveTime);

yield WaitForSeconds(pausetime);

transform.position = Vector3.Lerp(position2.transform.position, position1.transform.position, moveTime);

hasnowmoved = false;
ison = false;

}

movetime is set to 1, so I expected the object to move from position1 to p[osition2 in one second, but does it instantly. I’m not sure if I have codedit wrong, or if it’s missing something, any help would be appreciated.

Vector3.Lerp smoothly transitions from first Vector3 to the second Vector3 as its third argument (moveTime) ranges from 0 to 1. Setting moveTime to 1 essentially tells Vector3.Lerp to return a value exactly equal to the second Vector3, which is your destination.

What you want to do instead is to begin with moveTime == 0, then add Time.deltaTime to it during Update(). This will cause it to move over the course of one second.

If you want it to take two seconds, you’d want to change the third argument to moveTime / 2f.