#### Archived

This topic is now archived and is closed to further replies.

# 'Up' Vector

## Recommended Posts

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

##### Share on other sites
Guest Anonymous Poster
You might try using quaternions...

http://www.gamasutra.com/features/19980703/quaternions_01.htm
http://www.cs.ualberta.ca/~andreas/math/matrfaq_1.04.html#Q47

##### Share on other sites
Wow Lots of math
I''ll give it a try

##### Share on other sites
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.

##### Share on other sites
sark    104
do yourself a favour and check out the camera tutorials on www.gametutorials.com

##### Share on other sites
Hybrid    138
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