I'm using a FPS script for general navigation, but also have a 'tour' script which moves my player (and cam) around to some pre-defined views. In doing so, sometimes a 'roll' angle is introduced (for the nice view).
When the user moves the player (say, with mouselook or WASD), I want to remove any 'roll' that might have been introduced, leaving just pitch and yaw. Any ideas the best way to do this?
You can apply a corrective rotation that aligns the object's up vector with the world up vector. This can be easily done in Unity using Quaternion.FromToRotation().
That said, an even easier solution would be to use a control scheme that doesn't introduce perceived roll in the first place. (I don't know what control scheme you're using currently, so I can't be much more specific than that.)
[Edit: Adding additional info following comments.]
Here is what I'd probably try:
At the moment the user provides input while the camera is in 'tour' mode, grab the camera's orientation and store it.
To 'correct' the camera's orientation, I think what you'll want to do is adjust it so that the camera's side vector lies in the XZ plane (assuming y is up). One way to do this would be to project the side vector onto the XZ plane, normalize the result, and then apply a corrective rotation (as I mentioned earlier) to rotate the current side vector onto the 'corrected' side vector. Note that cases where the projection has small magnitude (such as when the camera is on its side, more or less) will need to be handled separately.
Once you have the corrected orientation, you can compute the yaw and pitch directly from the forward vector. At this point you can switch over to your standard yaw/pitch-based FPS-style control.
Presumably you won't want this to happen instantaneously, as that would be a little jarring, but what you can do to smooth out the effect is interpolate between the last orientation for the 'tour' camera (which you saved in step 1) and the current orientation of the camera over some short interval.
I haven't actually tried the above myself, so it's somewhat speculative. But, it's probably what I'd try first.