Camera rotation on z axis

I am trying to turn my camera on the z axis by 25 degrees. I got it to rotate properly if I turn on the right, but whenever I hit something on the left, my camera just does a 360 and goes back to zero. How do I change it so that my camera will only turn -25 degrees to the left and not do the 360? The issue is with the left impact.

        if(leftImpact)
        {
            Vector3 euler = fpsCam.transform.localEulerAngles;
            euler.z = Mathf.Lerp(euler.z, -25, 2f * Time.deltaTime);
            fpsCam.transform.localEulerAngles = euler;
        }

        if(rightImpact)
        {
            Vector3 euler = fpsCam.transform.localEulerAngles;
            euler.z = Mathf.Lerp(euler.z, 25, 2f * Time.deltaTime);
            fpsCam.transform.localEulerAngles = euler;
        }

You’re not using Lerp correctly, see the documentation(
lerp documentation
)you should try doing just “euler.z = euler.z + 25” and “euler.z = euler.z - 25”
though you may be faced with the new problem of your camera spinning too fast

Use Quaternion.Slerp instead of just Lerping between Euler angles.

Quaternion targetRotation = Quaternion.Euler(transform.localEulerAngles.x, transform.localEulerAngles.y, -25);

transform.localRotation = Quaternion.Slerp(transform.localRotation, targetRotation, speed * Time.deltaTime);