sunnymonk
03-31-2005, 08:59 PM
Hi,
My problem is this.. I have a cube in my world situated at the origin. I hope to rotate my camera about a global axis such that the camera travels in a sphere-like manner(surrounding the cube). I want my camera to always look at the cube while it is rotating.
When the user press the up/down arrow key, the camera will rotate about the x-axis of the global axis, rotating in a spherical manner. Likewise, when the user press the left/right arrow key, the camera will rotate about y-axis of the global axis. I do not want rotations to be built on top of each other's local axis.
However, i have other functions like zoom in, zoom out, move the cube vertical or horizontally across the screen that depends on the local axis of the cube.
This means after i rotate in the global axis, i might need to do a zoom or a move in local axis after the cube has been rotated.
This local/global thing has been confusing..but what i need to know is how to accomplish the sperical rotation i have specified above in global axis? i think part of the difficulty is that the camera must always look at the cube while it is rotating.
can i know how to do that using gluLookAt or other functions? I am quite a novice .. Can anyone help me? Thanks!
Cheers,
monk :)
My problem is this.. I have a cube in my world situated at the origin. I hope to rotate my camera about a global axis such that the camera travels in a sphere-like manner(surrounding the cube). I want my camera to always look at the cube while it is rotating.
When the user press the up/down arrow key, the camera will rotate about the x-axis of the global axis, rotating in a spherical manner. Likewise, when the user press the left/right arrow key, the camera will rotate about y-axis of the global axis. I do not want rotations to be built on top of each other's local axis.
However, i have other functions like zoom in, zoom out, move the cube vertical or horizontally across the screen that depends on the local axis of the cube.
This means after i rotate in the global axis, i might need to do a zoom or a move in local axis after the cube has been rotated.
This local/global thing has been confusing..but what i need to know is how to accomplish the sperical rotation i have specified above in global axis? i think part of the difficulty is that the camera must always look at the cube while it is rotating.
can i know how to do that using gluLookAt or other functions? I am quite a novice .. Can anyone help me? Thanks!
Cheers,
monk :)