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;
}