Making a Smooth camera zoom with transform.Translate

I’m trying to use Lerp in Translate but i can’t figure out a practical solution that may be too complex, here’s what i’m doing:

        if (Input.GetAxis("Mouse ScrollWheel") > 0)
            Camera.main.transform.Translate(_camZoomSpeed * Vector3.forward * Time.deltaTime);
        else if (Input.GetAxis("Mouse ScrollWheel") < 0)
            Camera.main.transform.Translate(_camZoomSpeed * Vector3.back * Time.deltaTime);

Nothing out of the ordinary.

However i want this process to be smooth and i can’t figure out an easy way to do this that uses local translation like transform.translate does. This does the movement i want, yet it does not feel smooth since i would need Lerp for that.

Is there any way to do this in a kind of simple way without messing the code too much? I think i’m missing something and i don’t know what.

Try this:

Camera.main.transform.position = Vector3.Lerp(startPos, endPos, Time.deltaTime * zoomSpeed);

just change position to localposition if you want. for end pos, just pick a point along the Vector3.back or forward. Play around with how far back or forward until you get it feeling right.

Hope that helps!