Jump to content
  • Advertisement

Archived

This topic is now archived and is closed to further replies.

Boris Karloff

Rotating the view matrix

This topic is 5830 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 was just wondering about this... A lot of people speak of trouble with their lookat and up vectors when looking straight up or down, since these two vectors can''t be parallel to each other... I''m assuming that these people recalculate the view matrix every time the pos, lookat or up vector changes. Wouldn''t it be much easier to just set an initial view matrix to a position of (0,0,0), the lookat vector to (0,0,1) (forward) and the up vector to (0,1,0) (up), and then just multiply that matrix with the required rotation/translation matrices? That way, your two vectors are alway perpendicular, and you''d never have to worry about epsilons and looking straight up and such. Also, it would appear more efficient to multiply a matrix with two other matrices than to call D3DXMatrixLookAtLH... Or is there a better way?

Share this post


Link to post
Share on other sites
Advertisement
Gimbal lock != (up==direction)


Usual way is to simply take the dot product between the **approximate** up vector and the direction vector - if the angle is less than a threshold, swap the components of the up vector - simple.

--
Simon O''Connor
Creative Asylum Ltd
www.creative-asylum.com

Share this post


Link to post
Share on other sites

  • Advertisement
×

Important Information

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

GameDev.net is your game development community. Create an account for your GameDev Portfolio and participate in the largest developer community in the games industry.

Sign me up!