# How do I tilt my camera when I'm doing a certain action

I want to rotate my camera to a certain degree when I am doing a certain action, can anyone help?

public Camera _camera;
private float degrees = 0;

``````    // Update is called once per frame
void Update()
{
Vector3 EulerRotation = _camera.transform.rotation.eulerAngles;

if (Input.GetKey(KeyCode.A)) //While holding down 'a', rotate camera to the left
{
if (degrees < 20)
{
degrees += 2f;
_camera.transform.rotation = Quaternion.Euler(EulerRotation.x, EulerRotation.y, degrees);
}
}

else if (Input.GetKey(KeyCode.D)) //While holding down 'd', rotate camera to the right
{
if (degrees > -20)
{
degrees -= 2f;
_camera.transform.rotation = Quaternion.Euler(EulerRotation.x, EulerRotation.y, degrees);
}
}

if (Input.GetKeyUp(KeyCode.A)) //If i let go of 'a', return camera to default rotation
{
Start:

degrees -= 2f;
_camera.transform.rotation = Quaternion.Euler(EulerRotation.x, EulerRotation.y, degrees);

if (degrees != 0)
goto Start;
}

else if (Input.GetKeyUp(KeyCode.D)) //If i let go of 'd', return camera to default rotation
{
Start:

degrees += 2f;
_camera.transform.rotation = Quaternion.Euler(EulerRotation.x, EulerRotation.y, degrees);

if (degrees != 0)
goto Start;
}
}
``````