Skip to main content
GameDev.net gamedev.net
🔒 Locked

Matrix from direction + position

Started by 0v3rloader Jul 31, 2007 at 10:45 AM 1 replies 800+ views
Original Post
0v3rloader
0v3rloader
Hi, I need to create a 4x4 matrix from a direction vector and position. Can someone point me to a link where I can learn how to do this? Thank you.
jpetrie
jpetrie
Depends what kind of meaning you want that position and direction to have with respect to the resulting transformation. The typical use for those inputs is to construct a view matrix (you will need a third "up" vector to give meaning to the basis, as otherwise there are an infinite number of choices).

This is generally done in exactly the same fashion that gluLookAt performs its calculation (that link describes the math behind it). You may need to adjust slightly for your needs.
0v3rloader
0v3rloader
Quote:
Original post by jpetrie
Depends what kind of meaning you want that position and direction to have with respect to the resulting transformation. The typical use for those inputs is to construct a view matrix (you will need a third "up" vector to give meaning to the basis, as otherwise there are an infinite number of choices).

This is generally done in exactly the same fashion that gluLookAt performs its calculation (that link describes the math behind it). You may need to adjust slightly for your needs.


That's exactly what I needed man! Much appreciated!

Topic Locked

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

Sign in to reply to this topic.