Problems moving the camera
To post on Game Programming forum:
I'm starting work on my first game, and I'm doing all the programming from scratch in C# using DirectX. But I've picked up a small problem.
I use the following code:
to handle camera movement. So When I move the mouse the camera looks around, and moving the mouse up or down tilts the camera up or down, just as you would expect. But, the further I turn, the less acurrate the camera tilting becomes. It is a bit difficult to explain. Lets say I've turned left 90 degrees to the left. I now try to look up or down, but instead it rotates the camera. This doesn't happen when the camera is looking straight ahead when I start the app, but the further I turn, the worse the rotating becomes when I move the mouse up or down.
device.Transform.View = Matrix.Translation(new Vector3(Camera.posX, Camera.posY, Camera.posZ)) * Matrix.RotationYawPitchRoll(Camera.lookX, Camera.lookY, 0);
Does anyone know what's going on here, or how I can fix it?
BTW: Here is the code I use to get the mouse position:
PS: While I was writing this post, I ran the app again, and it would seem that it is actually rotating my ground mesh instead of my camera. This would make sense because if I am looking to the right, and I drag the mouse down to tilt the camera, it is actually tilting the world or the mesh, which makes it tilt to the left. Any advice?
DInput.MouseState state = mouseDevice.CurrentMouseState;
Camera.lookY += ((state.Y*-1)*mouseSensitivity);
Camera.lookX += ((state.X*-1)*mouseSensitivity);