Rotate Smoothly

I am making a hovercraft game and have a good movement script for it. I am not sure on how to rotate it. I want it to rotate it when I press a key. I would also like for it to rotate smoothly and only to a max angle, and when I let the key go it goes back to its original rotation. I’m sorry if this is hard to understand. Thanks!

Assuming you want to rotate y, and nothing else will affect the y rotation, this script should work nicely. I have not tested it though.

private float m_MaxAngle = 25.0f;
private float m_Angle = 0.0f;
private float m_SmoothValue = 3.0f;

void Awake()
{
	m_Angle = transform.rotation.eulerAngles.y;
	m_MaxAngle += m_Angle;
}

void FixedUpdate()
{
	float input = Input.GetAxis("Horizontal");
	m_Angle = Mathf.Lerp(m_Angle, m_MaxAngle * input, Time.deltaTime * m_SmoothValue);
	Vector3 euler = transform.rotation.eulerAngles;
	euler.y = m_Angle;
	transform.rotation = Quaternion.Euler(euler);
}