Jump to content
  • Advertisement
Sign in to follow this  
webjeff

Camera (Obtain World Matrix)

This topic is 3734 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

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
Advertisement
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
Sign in to follow this  

  • Advertisement
×

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

We are the game development community.

Whether you are an indie, hobbyist, AAA developer, or just trying to learn, GameDev.net is the place for you to learn, share, and connect with the games industry. Learn more About Us or sign up!

Sign me up!