I finally decided to go grab SFML 2.0 (it was about time, I guess) and see
what your code does, and I just wanted to comment on a couple of things.
my current setup doesn't have that problem |
This is true, but it is at the expense of imposing constraints on the camera movement. Try tilting down and moving up until you can only see the red faces of your cubes. Then, try panning left and right. You'll notice
that the camera instead rotates around its forward (z') axis. This is an indication that your camera's up (y')
axis is always equal to the global y axis, much like in a FPS setup (and my first post). My point here is that
the inconvenience I mention is not really a 'problem'. It's just a(n) (unavoidable) side-effect of entirely unconstrained camera movement. You can't have the latter without the former.
Another thing I noticed is that after moving to the position and orientation I mentioned above, I was unable to continue tilting down in order to see the yellow faces. I had to rotate 180 degrees around the forward axis
(by exploiting the panning 'bug') and then tilt up. I figured it had to do with the if statements, so I commented them out and tried again. This time, I was able to continue tilting, but when I could only see the yellow faces the panning controls were inverted (which is also a side-effect of y' == y, and, I guess, the reason you put the if statements there).
I'm not saying your setup is a bad setup for panning and tilting; actually, this is exactly the expected behaviour in a FPS game. It's just that it doesn't mesh well with the rest of your expectations from the camera movement, and this is probably the reason you got stuck. Think about it: Panning, as you implemented it, requires that
y' == y. However, the rotation around the forward axis you wanted to introduce has to change y' in order to work properly (and, of course, the incompatibility is there even if you don't explicitly maintain such a vector).
http://tinypic.com/r/25qzuwh/5
PS: Congrats though for managing to pull this off with sin and cos. I'm not sure I have the patience to do this...