Archived

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

MattCarpenter

'Up' Vector

Recommended Posts

MattCarpenter    142
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 this post


Link to post
Share on other sites
Guest Anonymous Poster   
Guest Anonymous Poster
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/

Share this post


Link to post
Share on other sites
MattCarpenter    142
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 this post


Link to post
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

Share this post


Link to post
Share on other sites