I realized there is totally a way to do it and answered my own question. Something like this works:

Code: Select all

```
getCameraNode()->rotate(qPitch);
getCameraNode()->rotate(qYaw,Ogre::Node::TS_WORLD);
```

I believe that's what the SetFixedYawAxis() function can handle as well but will have to try that. But still curious if this can be done in a single call to rotate() without inducing roll.

EDIT: For reference, this did not work as expected:

Code: Select all

```
getCameraNode()->setFixedYawAxis(false);
getCameraNode()->rotate(qPitch);
getCameraNode()->setFixedYawAxis(true, Ogre::Vector3::UNIT_Y);
getCameraNode()->rotate(qYaw);
```

I am assuming I have the wrong idea about what setFixedYawAxis() is capable of.

EDIT2: I found that rotating the single camera node loses proper track of the angle of rotation around the X-axis which is needed to make sure the player can't pitch up and down in 360 degrees of freedom. The pitch angle is falsely reported when turning left or right when using a single scenenode for FPS style camera instead of the proper 2 scenenodes.

Example:

Code: Select all

```
float pitchAngle = (2 * Ogre::Degree(Ogre::Math::ACos(getCameraNode()->getOrientation().w)).valueDegrees());
// Just to determine the sign of the angle we pick up above, the
// value itself does not interest us.
float pitchAngleSign = getCameraNode()->getOrientation().x;
// Limit the pitch between -90 degress and +90 degrees, Quake3-style.
if (pitchAngle > 90.0f)
{
if (pitchAngleSign > 0)
// Set orientation to 90 degrees on X-axis.
getCameraNode()->setOrientation(Ogre::Quaternion(Ogre::Math::Sqrt(0.5f),
Ogre::Math::Sqrt(0.5f), 0, 0));
else if (pitchAngleSign < 0)
// Sets orientation to -90 degrees on X-axis.
getCameraNode()->setOrientation(Ogre::Quaternion(Ogre::Math::Sqrt(0.5f),
-Ogre::Math::Sqrt(0.5f), 0, 0));
}
```