Reactor.RCamera.ChangeOrientation C# (CSharp) Method

ChangeOrientation() private method

Sets a new camera orientation.
private ChangeOrientation ( Microsoft.Xna.Framework.Quaternion newOrientation ) : void
newOrientation Microsoft.Xna.Framework.Quaternion The new orientation.
return void
        private void ChangeOrientation(Quaternion newOrientation)
        {
            Matrix m = Matrix.CreateFromQuaternion(newOrientation);

            // Store the pitch for this new orientation.
            // First person and spectator behaviors limit pitching to
            // 90 degrees straight up and down.

            float pitch = (float)Math.Asin(m.M23);

            accumPitchDegrees = MathHelper.ToDegrees(pitch);

            // First person and spectator behaviors don't allow rolling.
            // Negate any rolling that might be encoded in the new orientation.

            orientation = newOrientation;

            if (behavior == Behavior.FirstPerson || behavior == Behavior.Spectator)
                LookAt(R3DVECTOR.FromVector3(eye), R3DVECTOR.FromVector3(eye + Vector3.Negate(zAxis)), R3DVECTOR.FromVector3(WORLD_Y_AXIS));

            UpdateViewMatrix();
        }