Lerp transition/rotation?

Hello, I’m trying to make an object use lerp to transition from one transform/rotation to another. My code doesn’t work the way I want it to. It’s really jerky, and it transitions instantly instead of steadily.

var start : Transform;
var end : Transform;

function Update () {
	
		if( Input.GetButtonDown("Fire2")) {
			transform.position = Vector3.Lerp(start.position, end.position, Time.time);
		}else{
			transform.position = Vector3.Lerp(end.position, start.position, Time.time);
     }
}

Can someone correct it, please?

start and end aren’t changing- so it can’t lerp. you’re telling it to do the exact same thing every frame- the jerkiness is probably a side effect of that.

try something like this (untested C# off the top of my head, sorry)

private Vector3 targetPosition = Vector3.zero; 
private float [] dampVelocity = {0,0,0};
private float transitionSmoothing = 10f;

void Update () {

    if( Input.GetButtonDown("Fire2")) 
    {
      targetPosition = new Vector3(10f, 0f, 10f);            
    }
    else
    {
      targetPosition = new Vector3(-10f, 0f, -10f);
    }
    
    for(int i = 0; i < 3; i++)
    {
      transform.position <em>= Mathf.SmoothDamp(transform.position<em>, targetPosition<em>, ref dampVelocity_, transitionSmoothing * Time.deltaTime);_</em></em></em> 

}

}

That’s not how Lerp is used; see here, also this.