www.jpct.net

jPCT-AE - a 3d engine for Android => Support => Topic started by: FredAxis on November 13, 2013, 03:42:34 pm

Title: camera rotation on own X axis
Post by: FredAxis 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?
Title: Re: camera rotation on own X axis
Post by: FredAxis on November 13, 2013, 04:00:30 pm
Simple but effective. I changed the order of rotations and it did the trick.  ;D
Title: Re: camera rotation on own X axis
Post by: EgonOlsen 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.