Skip to main content
gamedev.net
🔒 Locked

Camera Matrices

Started by stickymango 1 reply 250+ views
Original Post
stickymango
stickymango
I am trying to calculate the three othrogonal camera axis but the only information I have is a Camera position and POI. Basically I know where the camera is and what its looking at so I can calculate the look-at vector, I now need to calculate the UP and RIGHT vectors based on this AT vector. This is to stop the camera image being distorted. I tried calculating the angles between the UP vector(0,1,0) and the AT vector to give me the vertical rotation angle around X and the same for the Right vector (1,0,0) and the AT, then rotating the camera matrices by these values but that doesn''t seemed to work, any suggestions? Cheers
Shrew
Shrew
youve got the lookat vector. You want up to be up:

How about taking the cross product of the lookat and (0,1,0)UP to get your right vector, and then taking the cross product of the lookat vector and the right vector just calculated to get the real up vector. that should give you the three axes you need. Normalise them of course.

I did something similar to gaurantee orientation of decals onto planes (if you can see what I mean)

Robert Swan
My company - Aah Games - http://www.aahgames.com
stickymango
stickymango
yep, got ya. I knew it would be blatantly obvious, I was almost there. I''d used an up vector (0,1,0) and calculated the right vector but left it at that. doh!

cheers

Topic Locked

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

Sign in to reply to this topic.