Author Topic: camera rotation on own X axis  (Read 1784 times)

Offline FredAxis

  • byte
  • *
  • Posts: 8
    • View Profile
camera rotation on own X axis
« on: November 13, 2013, 03:42:34 pm »
I have a skybox and I want to rotate the camera when my tablet is tilted on the X axis. It works but when I rotate the Y axis the X axis gets rotated too and so the camera does not tilt but it is rotating (like on its Z axis).

My code ..
Code: [Select]
[code]
cam.rotateCameraX((tilt+90)*rad2bogFac);
cam.rotateCameraY(yaw*rad2bogFac);
[/code]      

How would I tilt the camera the right way?

Offline FredAxis

  • byte
  • *
  • Posts: 8
    • View Profile
Re: camera rotation on own X axis
« Reply #1 on: November 13, 2013, 04:00:30 pm »
Simple but effective. I changed the order of rotations and it did the trick.  ;D

Offline EgonOlsen

  • Administrator
  • quad
  • *****
  • Posts: 12295
    • View Profile
    • http://www.jpct.net
Re: camera rotation on own X axis
« Reply #2 on: November 13, 2013, 10:02:40 pm »
You might run into similar issues if rotations become for complex. In that case, take a look at the rotateAxis()-method.