# Rotate camera 360 degrees

I am a bit confused about the input values of setDirection

```   public void RotateCamera(float x, float y, float z)    {       Camera myCam = implRef.getCamera();       myCam.setDirection(myCam.getDirection().add(x,y,z));       Vector3f tmpLoc = myCam.getDirection();       System.out.println("myx:" + tmpLoc.getX() + "myy:" + tmpLoc.getY() + "myz:" + tmpLoc.getZ());    }```

I am calling it like this: RotateCamera(1,0,0);

In that example my camera rotates exponentally more in the ranges 0-10 than it does 10-50, and once you get past 50 it barely moves at all.

I haven't done much graphics programming - so maybe it is a well-known concept that I'm just not familiar with.

You cannot rotate a direction by adding x,y,z to it (how do you specify rotation by x,y,z anyway?). Direction should generally be unit length. Use Quaternions to rotate a direction vector (maybe you need to read up on rotation in 3D space first).

irrisor said:

(how do you specify rotation by x,y,z anyway?)

I was thinking of it more as rotation around that specific axis, specified in degrees/radians/etc - that's why I couldn't figure out why the rotation wasn't equal for each unit added.  I'll read up on quaternions though, thanks for the help.

Well after a bit of reading on quats I came up with this alternative, which seems to work:

```   public void RotateCamera(float Degrees)    {       // Get current camera angles/axis       Vector3f tmpVec = new Vector3f();       float tmpAngle = CamQuat.toAngleAxis(tmpVec) * FastMath.RAD_TO_DEG;       // Set new values...       tmpAngle += Degrees;       if (tmpAngle > 360)       {          tmpAngle -= 360;       }       else if (tmpAngle < 0)       {          tmpAngle += 360;       }       CamQuat.fromAngleNormalAxis(tmpAngle * FastMath.DEG_TO_RAD, tmpVec);       implRef.getCamera().setAxes(CamQuat);    }```

I still don't quite understand how myCam.setDirection works though - since it seems that you would be passing it a Vector3f defining an axis, which is fairly useless without w, the angle.  I guess that brings me back to your question - how do you specify rotation with x,y,z (a Vector3f)?

The "direction" parameter is not a rotation but a direction vector --> you do not specify rotation here

(note that you need to change up and left vector as well when you change direction of the camera)