Sign in to follow this  

D3D8 Camera

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

This topic is 4553 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.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this