I want to make it so that either the pitch yaw or roll rotates around the world axis and not the local axis, but I'm not sure how, I've got.
Vector2 mouse_change = new Vector2(mouse_previous.X - mouse_new.X, mouse_previous.Y - mouse_new.Y); camera_angles *= Quaternion.CreateFromAxisAngle(new Vector3(0, 1, 0), mouse_change.X / 800f); camera_angles *= Quaternion.CreateFromAxisAngle(new Vector3(1, 0, 0), mouse_change.Y / 800f);
Updating every frame, then I've got.
view_matrix = Matrix.Invert(Matrix.CreateFromQuaternion(camera_angles) * Matrix.CreateTranslation(camera_position)); projection_matrix = Matrix.CreatePerspectiveFieldOfView(MathHelper.PiOver4, device.Viewport.AspectRatio, 0.2f, 500f);
The problem is that if I e.g. change the pitch then change the yaw then the yaw changes through the local axis, I need it to turn around the world axis so that it doesn't matter what the yaw is :/.