Using Lerp to look up with your local camera?

Hi, so I’ve been using lerp for the first time and I’m a bit confused. Here’s my code;

if (Input.GetAxis("Mouse Y") > .1f & disableMotion == 0)
{
	cameraobj.transform.localPosition = new Vector3(.9f, Mathf.Lerp(4, 7, Time.deltaTime), -4.5f);
}

I plan on modifying the rotation of X later, but I wanted to figure out what I’m doing first. This code is being run within Void Update of course. Am I using the wrong kind of Lerp?

The result is an instantaneous .5f jump in my Y Axis and then it just stops. I think it’s probably because I’m using = new Vector3, but I have to run to work now unfortunately and the scripting reference told me to use = new Vector3. Thanks for the help guys.

Read the explanation I gave here :

I don’t like the example Unity gave about LERP.

For your problem, here is a simple example :

private float t = 0 ; // Parameter of the Lerp    
private float duration = 5 ; // Duration of the lerp transition = 5 seconds


void Update()
{
    ....
    if (Input.GetAxis("Mouse Y") > .1f && disableMotion == 0)
    {
        if( t > duration )
            t = 0 ;
        
        cameraobj.transform.localPosition = new Vector3(.9f, Mathf.Lerp(4f, 7f, t / duration), -4.5f);
        
        t += Time.deltaTime ;
    }
    else
        t = 0 ;
    ...
}