Jump to content
  • Advertisement
Sign in to follow this  
Corsix

D3D8 Camera

This topic is 4762 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 am having a little problem with the D3D8 camera. Basically, I want the camera pointing at the origin, and rotating around it when the user moves the mouse. At the moment I am using D3DXMatrixRotationX/Z and D3DXVec3TransformCoord to change the view matrix upon mouse movement:
case WM_MOUSEMOVE:
			{
				int xPos = (GET_X_LPARAM(lParam)) - 300;
				int yPos = (GET_Y_LPARAM(lParam)) - 300;
				if(abs(xPos) > 5 || abs(yPos) > 5)
				{
					D3DXMATRIX mtxRot;
					D3DXMatrixRotationZ(&mtxRot,((float)xPos)/1000.0);
					D3DXVec3TransformCoord(&m_vecCameraPosition,&m_vecCameraPosition,&mtxRot);

					D3DXMatrixRotationX(&mtxRot,((float)yPos)/1000.0);
					D3DXVec3TransformCoord(&m_vecCameraPosition,&m_vecCameraPosition,&mtxRot);

					D3DXMatrixLookAtLH(&m_matView, &m_vecCameraPosition,&m_vecCameraLookAt,&m_vecCameraUp);
				}
			}
			return 0;
However, this is not working. So, A) Can you tell why? B) Is there a better solution?

Share this post


Link to post
Share on other sites
Advertisement
Thanks =)
Got the camera movement code working when controled by the keyboard, but ouse input isnt quite working yet...

Share this post


Link to post
Share on other sites
Sign in to follow this  

  • 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!