Original Post
I know this has been asked umpteenth times, but I've looked around and haven't found anything that has helped me to my satisfaction. I decided to create my own view matrix from scratch to represent the camera.
The camera has 3 vectors, up, right, forward, representing orientation, and a position vector.
Every frame I build a view matrix from those vectors and load it as the modelview matrix. It looks like this:
where e is -[r|u|f]T * p
To rotate the camera up and down I build a rotation matrix from the camera's right vector, and then multiply [r|u|f] by this matrix. The rotation matrix is I + (sin(angle) * S) + ((1 - cos(angle) * S^2) where I = identity, s =
To rotate the camera left and right I do the same, except build the rotation matrix from the camera's up vector.
This does work to some extent, I do see rotation happening, but somehow it doesn't look right.
Instead of using the camera's right and up vectors I've also tried building rotation matrices out of the x and y axes but although that looks right in some instances it doesn't look right in others.
After combining several movements (rotate left 20, rotate up 10, rotate left 2, rotate up 1, rotate right 100, etc etc) the object I'm viewing gets totally skewed, as if the camera is being operated by a drunk with an inner ear problem.
If someone can explain to me what I'm doing wrong I'd appreciate it greately.
------------
- outRider -
Edited by - outRider on February 5, 2002 12:23:15 AM
r.x r.y r.z e.x u.x u.y u.z e.y f.x f.y f.z e.z 0 0 0 1 |
0 -r.z r.y r.z 0 -r.x -r.y r.x 0 |