# set camera rotation through quaternion?

I have a key command move the camera to a new position, I want to do something similar with the camera rotation, but I don’t quite understand how to pass the rotation values to the camera, trying to use quaternions, but don’t quite get the Quaternion.identity implementation- any help?

Quaternion newRotation = target.rotation;
//transform.rotation = Quaternion.(newRotation);

``````		Vector3 positionA = new Vector3 (-45, 15, 0);
Quaternion rotationA = new Quaternion (0,0,0);

Vector3 positionB = new Vector3 (0, 20, 2);
Vector3 positionC = new Vector3 (20,8,-1);
Vector3 positionD = new Vector3 (40,10,-5);
Vector3 positionE = new Vector3 (-23,14,-81);

Vector3 positionF = new Vector3 (-1, 4, 8);

if (Input.GetKey (KeyCode.E))
newPosition = positionA;
if (Input.GetKey (KeyCode.E))
newRotation = rotationA;

if (Input.GetKey (KeyCode.R))
newPosition = positionB;

if (Input.GetKey (KeyCode.T))
newPosition = positionC;

if (Input.GetKey (KeyCode.Y))
newPosition = positionD;

if (Input.GetKey (KeyCode.U))
newPosition = positionE;

else if (Input.GetKey (KeyCode.I))
newPosition = positionF;
``````

Hi,

You almost have your answer with @maccabbe 's comment but since it’s a comment, let me make an answer to help other people in their search

Don’t try to understand Quaternions, you could but it’s high level maths and you would waste your time (go check Wikipedia) ^^

What you wanna do is to manipulate a “normal” Vector3 with rotations, something that is easier to understand and then let Unity do the job.

You can easily transform a Vector3 to a Quaternion by using (as @maccabbe said) `Quaternion.Euler(new Vector3(float x, float y, float z));` . Now you will want to pilot x, y and z with you keyboard the same way you do it for the movement of the camera. Let’s say you use WASD to move the camera, code a similar thing with the arrow keys to rotate it

Enjoy !