'Up' Vector

Started by
4 comments, last by MattCarpenter 21 years, 6 months ago
I am trying to make a flight-simulator game, but I''m having some trouble with the ''Up'' vector in my view matrix. What I am trying to do is tilt my view matrix when I turn the plane. Btw, this is a first person flight simulator. I have tried some other ways to get my camera to tilt using the up vector in the view matrix, but when I turn my camera it tilts one direction, then turns around and tilts another. How would I get my view to tilt? Thanks in advance
//att
Advertisement
You might try using quaternions...

Some Links:
http://www.gamasutra.com/features/19980703/quaternions_01.htm
http://www.cs.ualberta.ca/~andreas/math/matrfaq_1.04.html#Q47
http://www.google.com/
Wow Lots of math
I''ll give it a try
//att
I didn''t really understan those quad-whatevers, but I found out another way!
I just made a copy of my look-vector, but then added 45 degrees (1.57 radians) to it, and used that in my up vector.
//att
do yourself a favour and check out the camera tutorials on www.gametutorials.com
How to create the up vector:

Basically, you have your look vector, and set your up vector to exactly vertical (0,1,0 or whatever is up in your system).

Now then, basically the up vector is now set perfectly vertical regardless of your view vector which is of course wrong, as it should be at right angles to your view direction. So what you do is...

* do a cross product of view and up vectors, this will give you a ''right'' vector. Basically a vector pointing to the right.

* now do a cross product of your view vector and the right vector, and this will be the new CORRECT up vector.

Works every time

This topic is closed to new replies.

Advertisement