# Rotation too complicated

I’m trying to make my camera rotate based on Input.GetAxis(“Horizontal”) and changing this into a Vector3, but it looks like transform.rotate requires a “quaternion.” I tried setting the rotation to new quaternion(Input.GetAxis(“Horizontal”), 0.0f, 0.0f, 0.0f), but that just made everything go crazy!
Thank you.

I think what you need there is the Quaternion.Euler function

``````	float angle;

void Update () {

angle += Input.GetAxis("Horizontal");

transform.rotation = Quaternion.Euler(0,0,angle);

}
``````

This lets you set the rotation of your object using a Vector3.

If you want to lock the rotation after certain amount you could implement something like this:

``````	float angle;
float rotationLimit = -1.0f;

void Update () {

angle = Input.GetAxis("Horizontal");

transform.rotation = Quaternion.Euler(new Vector3(0,0,angle * Mathf.Rad2Deg) * rotationLimit);

}
``````

Quaternions don’t work that way. Also transform.Rotate() accepts Vector3 or 3 floats as parameter. Transform.Rotate()
You can basically set your rotation like:

``````transform.Rotate(Input.GetAxis("Horizontal"),0,0);
``````

Yup, I used the transform.Rotate and it worked just fine! Thanks a lot.