public void RotateAroundLookPositionWorld(Vector3 radians) { var matrix = Matrix3.Identity; matrix = matrix.RotateAroundWorldAxisX(radians.X); matrix = matrix.RotateAroundWorldAxisY(radians.Y); matrix = matrix.RotateAroundWorldAxisZ(radians.Z); Position -= LookAtPosition; Position = Position.Transform(matrix); Position += LookAtPosition; UpPosition -= LookAtPosition; UpPosition = UpPosition.Transform(matrix); UpPosition += LookAtPosition; }
public void RotateAroundPosition(Vector3 radians) { var matrix = Matrix3.LookAt((LookAtPosition - Position), (UpPosition - Position)); var matrixTranspose = matrix.Transpose(); matrix = matrix.RotateAroundAxisX(radians.X); matrix = matrix.RotateAroundAxisY(radians.Y); matrix = matrix.RotateAroundAxisZ(radians.Z); LookAtPosition -= Position; LookAtPosition = LookAtPosition.Transform(matrixTranspose); LookAtPosition = LookAtPosition.Transform(matrix); LookAtPosition += Position; UpPosition -= Position; UpPosition = UpPosition.Transform(matrixTranspose); UpPosition = UpPosition.Transform(matrix); UpPosition += Position; }