Jump to content
  • Advertisement


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



This topic is 5899 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 dont know why my Camera class is not working the numbers outpus are correct but the movements on screen dont match up when i rotate the camera by 180 degrees the moveforward would make me go backward, and infact all the controls are reversed, its like the more i rotate off the orignal direction the more off is the movement vectors until like i said 180 which causes everything to reverse, Does anyone have ever had this problem? does is have anything to do with the way D3D builds the view transformation???

Share this post

Link to post
Share on other sites
Actually, what it seems like you forgot is that the x, and y coords do not move with your camera. I actually had this problem before, and here's how I solved it:

//CENTER_(etc) - In my program, the main character
//X/Y - Variables which control the rotation on the X/Y axis
//Zoom - The zoom variable
//sin(), and cos() require including , you can look them up on microsoft's MSDN

D3DXMatrixLookAtLH( &matView,
&D3DXVECTOR3( sin(Y)*(Zoom-(Zoom*X))+CENTER_X, X*Zoom, cos(Y)*(Zoom-(Zoom*X))+CENTER_Z ),
&D3DXVECTOR3( 0, 1, 0 ) );
m_pd3dDevice->SetTransform( D3DTS_VIEW, &matView );

Btw, I swapped my 'z' coord with my 'y'.

[edited by - hello2k1 on April 28, 2002 11:05:04 PM]

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.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!