Skip to main content
gamedev.net
🔒 Locked

'Up' Vector

Started by MattCarpenter 4 replies 300+ views
Original Post
MattCarpenter
MattCarpenter
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
MattCarpenter
MattCarpenter
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
sark
sark
do yourself a favour and check out the camera tutorials on www.gametutorials.com
Hybrid
Hybrid
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

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.