   view matrix quaternion rotation
  i want to rotate the view with quaternions...but somethings wrong with my code:--------------------------------------------------------public void RotateCamera(float xAngle, float yAngle) {  device.Transform.View = initialMatrix;  Vector3 rightAxis = new Vector3(initialMatrix.M11,  initialMatrix.M21,  initialMatrix.M31);  rightAxis.Normalize();  Vector3 upAxis = new Vector3(initialMatrix.M12,  initialMatrix.M22,  initialMatrix.M32);  upAxis.Normalize();   Quaternion rotationRight = new Quaternion(rightAxis.X,    rightAxis.Y, rightAxis.Z, xAngle);  Quaternion rotationUp = new Quaternion(upAxis.X, upAxis.Y,  upAxis.Z, yAngle);  Quaternion rotation = Quaternion.Multiply(rotationRight, rotationUp);  device.Transform.View *= Matrix.RotationQuaternion(rotation);}-------------------------------------------------my idea: from the current view matrix, get the right vector (m11, m21, m31) and the up vector (m12, m22, m32)...just yaw and pitch, no roll...now i want to use quaternions to rotate about the right vector and the upvector and finally the view matrix about the product of both quaternions...language is c#... 
  Why not do this?Use the matrix to quaternion function to get the quaternion.Create a rotation quaternion using the yawPitchRoll function.Multiply themand then convert it back to the rotation matrix. That should do what you are looking for. ;  If you''re multiplying the view matrix in place, couldn''t you just multiply it directly by the matrix generated by the quaternion?   "Sneftel is correct, if rather vulgar." --Flarelocke ;  @ataruwhich matrix should i convert to a quaternion?...my problem ist the update of the view matrix: th camera rotates as long as the user presses the right mouse button...when he releases the mouse button, i have to update the view matrix, so i set the initialmatrix from the code to the actual view matrix...but: the control "flips" when i press the right mouse button again...so before for a left to right rotation i moved the mouse from left to right...now from right to left...and, after the update, the view "jumps" to another position...everything works fine as long as i rotate the view...is the general concept right?... ;  You convert your view matrix to a quaternion. And for each mouse press, multiply the rotation quaternion by the one obtained from the view.Then convert it back into a matrix, and set that matrix as your view. ;  ok, i''ll try it