i guess its all about the up vector .. but i just canīt figure out what to do ...
can someone complete the code ? or am i going the wrong way ?

thanx
uwi

08-10-2013, 07:09 PM

GClements

Quote:

Originally Posted by uwi2k2

i guess its all about the up vector .. but i just canīt figure out what to do ...
can someone complete the code ? or am i going the wrong way ?

If you want direct control over the view direction, using a "look-at" function is probably the wrong way to go about it. It's simpler to concatenate a translation, a rotation about the vertical axis and a rotation about the left-right axis. Also, the look-at approach has undefined behaviour if you're looking directly up or down.

A pitch angle of more than +/- 90 degrees will make the view upside down, which is impossible to achieve with a fixed up vector (it will combine a 180-degree rotation about the vertical axis with a pitch wrapped to the -90..+90 range).

But if you're committed to the look-at approach, you can just invert the up vector when the pitch is outside of that range.