Archived

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

Celeryface

Right And Up Vectors for Camera.

Recommended Posts

What are the equations for camera pan up, down, left and right? I want to move the Eye and Lookat at the same time for the Camera pan, so I believe I need to use the Right (1.0, 0.0,0.0) and Up (0.0,1.0,0.0) vectors do so. Anyone have any ideas on what I should do? (Where m_position is the Eye and m_lookat is the LookAt.) 1)Here is what I am doing for doing the camera PAN up: m_lookat+=(m_lookat*distance); m_position+=(m_up*distance); 2) This code is for doing camera PAN to the right: m_lookat-=(m_lookat*distance); m_position-=(m_right*distance); Thanks for the help in advance.

Share this post


Link to post
Share on other sites
Oh, boy. Camera stuff. I''ll bet you''re discovering just how much fun it can be , and you ain''t seen nothing yet.

OK. As far as I can tell, you''re using a m_Position vector for the position of your camera in real space and an m_LookAt vector for... What? Basically, there are two possibilities, and you seem to have confused them.

(1) m_LookAt is an actual vector (describing a direction, like m_Up or m_Right) that points away from m_Position in the direction of your focus point. If this is the case, this vector won''t need to be changed - the direction will stay the same as long as you''re panning and not rotating.

(2) m_LookAt is your actual focus point. If this is the case, you will just do the same thing to m_LookAt as you do to m_Position; that is, m_LookAt += (m_Up * distance) for panning up-and-down, and m_LookAt += (m_Right * distance) for panning side-to-side.

That''s half of your problem. Hang on tight for the second part...

You''ll still want the += operator for moving to the right. Again, as in the case of the m_LookAt vector (assuming possibility #2 above is true), you''ll need to multiply the distance by the m_Right vector, not the m_LookAt. I''m not sure what you''re trying to do, adding a positional vector to itself...

That should do it. By the way, you might want to try the math and physics forum, or the game programming forum - this doesn''t seem to be a very DirectX-specific problem. Still, hope I helped.

- TythosEternal



"Who''s John Galt?"

Share this post


Link to post
Share on other sites