Archived

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

Panning the Camera

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

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 on other sites
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 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 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 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 on other sites
Have you thought of using orthonormalised bases ?

Reg''ds,
sTeVe

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.

1. 1
2. 2
Rutin
28
3. 3
4. 4
khawk
14
5. 5

• 11
• 11
• 23
• 10
• 9
• Forum Statistics

• Total Topics
633648
• Total Posts
3013112
×