Sign in to follow this  
webjeff

Camera (Obtain World Matrix)

Recommended Posts

I have a camera, that I set pos/lookat/up vectors with. I want to be able to render a box where the camera is. To do this, I want to build a world matrix from the position the camera is at (simple), but I also need the rotation. So, what I have: Pos - position of the camera (translation) Look - look point of the camera. Dir - direction vector (subtracted from pos and normalized) Up - my up vector. View matrix So, to get a world matrix with rotation, should I calculate it based on my direction vector and try to figure out some calculation that way, or is it easy to get that from the view matrix (maybe invert it) Not sure. Any thoughts? Thanks

Share this post


Link to post
Share on other sites
The inverse of the view matrix is the camera's world-space matrix. You can use that to transform the box. Of course you'd need a second camera, because if you always rendered a box where the first camera was, and you were always rendering the scene from the point of view of that camera, then you'd always have this box in your face [grin]

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this