I have a standard 3D player camera which can be rotated on the pitch and yaw axes, but not on the roll axis. The rotation order is yaw-pitch-roll.
By default pitch rotates around the x-axis, yaw rotates around the y-axis and roll around the z-axis.
I want the player to be able to walk onto a sloped surface, so that the camera will be relative to that surface afterwards. So, for example, the player can move from the ground plane to a 90 degree wall, after which the wall should 'become' the new ground and the player should be able to rotate the camera relative to the wall as if it was the ground plane. So, let's say in the new coordinate system, pitch rotates around the x-axis, yaw rotates around the z-axis and roll around the y-axis, so yaw and roll have essentially switched their roles.
My problem is, I want to smoothly transition between the two coordinate systems, so that roll is 0 both before and after the transition. Rotation around the roll-axis during the transition is fine (but should be a minimum).
I can work with either euler angles or quaternions. What are my options?