Lerp Lanes

Hello…
I am trying to make a runner game with lanes…
I have the movement on Z axis and Lerping on X axis
but the lerp is not smooth…it gets stuck at half point on the X axis

is it coz of the movement ?

here is my code on the update function

		if(Input.GetKeyDown(KeyCode.Q))
			transform.position = Vector3.Lerp(transform.position, new Vector3(-3.75f, transform.position.y, transform.position.z), 100 * Time.deltaTime);
		if(Input.GetKeyDown(KeyCode.W))
			transform.position = Vector3.Lerp(transform.position, new Vector3(-1.25f, transform.position.y, transform.position.z), 100 * Time.deltaTime);
		if(Input.GetKeyDown(KeyCode.E))
			transform.position = Vector3.Lerp(transform.position, new Vector3(1.25f, transform.position.y, transform.position.z), 100 * Time.deltaTime);
		if(Input.GetKeyDown(KeyCode.R))
			transform.position = Vector3.Lerp(transform.position, new Vector3(3.75f, transform.position.y, transform.position.z), 100 * Time.deltaTime);

Have you tried Vector3.MoveTowards?
https://docs.unity3d.com/Documentation/ScriptReference/Vector3.MoveTowards.html

i just tried MoveTowards… and its still the same as lerp

GetKeyDown doesn’t loop , try GetKey

yay, Thanks man this got it working like i wanted :smile: