Jump to content
  • Advertisement

Archived

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

CpMan

Panning the Camera

This topic is 6109 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

How do I translate a camera matrix up/down, left/right so that the translations are always parrallel to the screen, regardless of any other rotations and the like in the world. Like panning in a 3D Modeler Thanks Matt

Share this post


Link to post
Share on other sites
Advertisement
there is a bunch of matrix functions included in the dxsdk. There''s a bunch of d3dxmatrix* functions. When you go to set up the camera matrix, change the values depending on where you want the scene to be located.

Share this post


Link to post
Share on other sites
I have that part down. This is the problem. Say I have a tradition viewpoint, like 0,0,0 looking at 0,0,-10. panning then is simple, simply add whatever the magnituse of the pan is to each vector, then recreate the camera matrix using one of D3DX''s functions. but say I rotate the camera around 0,0,-10, so that instead of the camera position being a simple 0,0,0, it is now 1,1,1, or something thatmakes the D3D x and y axes parrallel to the screen. Then, when trying to do a pan, adding the values to the x and y axes, the sideways pan might not be the logical sideways because the axes in world space are not situated logically in camera space. The pan may go inwards or up, or any other direction based on what other rotations have been made. So I need to be able to pan in the directions that are logical to the user. In other words, I need a set of temporary axes that correspond to the current view, not to the world, on which to pan. Get it?

Share this post


Link to post
Share on other sites
yup i get it, try saving the rotation angle in radians in a matrix and also keep the pan relevant to the rotation, xpan, ypan, in a matrix and the current position in doubles or floats. First move the original matrix to the current position. Then, I''m just guesing on it, but create a new matrix. Multiply the rotation matrix and the x/y pan matrix into the new matrix. Then multiply the original matrix with the new matrix and hopefully it might work.

i''m a terrible writer, hope you understand it...

Share this post


Link to post
Share on other sites
Translate x by the sin(RotationAngle) * the horizontal movement you want

Translate Y by the actual vertical movement wanted

Translate Z by the cos(RotationAngle) * the horizontal movement you want

Of course this is only for Rotation around the Y axis!

Share this post


Link to post
Share on other sites
I was being relatively stupid. I already had a previous camera look-at matrix; all I had to do was extract the axes from it and step along those.

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.

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!