This problem has totally eluded me for weeks now. I simply cant find a way in which to solve it.
Right, I have a cube centered at the origin, and a camera that rotates around it (looking at the origin all the time). Now its simple to rotate the camera in the x or y direction I can do that.
But I want it so that when the user wants to rotate the cube ‘upwards’ I want the camera to move in accordance with the camera orientation, not the axis of the cube. Do you understand what I mean?
Can anyone help me?
Have you tried gluLookAt() ?
It greatly simplifies such operations.
Originally posted by marcus256:
[b]Have you tried gluLookAt() ?
It greatly simplifies such operations.[/b]
Yeah I use gluLookAt.
But I still cant rotate the camera downwards. It rotates in the world axis. How do I calcul the down ward vector to rotate? Or the right or up for that matter?
I’m not sure if I understand it correctly, but have you tried rotating before doing gluLookAt()?
If I remember it correctly, gluLookAt uses the existing matrix (it does not make its own identity matrix), so by rotating the identity matrix, you should simply rotate the camera (and nothing else). (I may be wrong - I have not given this answer much thought)