Reactor.RCamera.RotateOrbit C# (CSharp) Method

RotateOrbit() public method

Rotates the camera for orbit behavior. Rotations are either about the camera's local y axis or the orbit target's y axis. The property PreferTargetYAxisOrbiting controls which rotation method to use.
public RotateOrbit ( float headingDegrees, float pitchDegrees, float rollDegrees ) : void
headingDegrees float Y axis rotation angle.
pitchDegrees float X axis rotation angle.
rollDegrees float Z axis rotation angle.
return void
        public void RotateOrbit(float headingDegrees, float pitchDegrees, float rollDegrees)
        {
            float heading = MathHelper.ToRadians(headingDegrees);
            float pitch = MathHelper.ToRadians(pitchDegrees);

            if (preferTargetYAxisOrbiting)
            {
                Quaternion rotation = Quaternion.Identity;

                if (heading != 0.0f)
                {
                    Quaternion.CreateFromAxisAngle(ref targetYAxis, heading, out rotation);
                    Quaternion.Concatenate(ref rotation, ref orientation, out orientation);
                }

                if (pitch != 0.0f)
                {
                    Quaternion.CreateFromAxisAngle(ref WORLD_X_AXIS, pitch, out rotation);
                    Quaternion.Concatenate(ref orientation, ref rotation, out orientation);
                }
            }
            else
            {
                float roll = MathHelper.ToRadians(rollDegrees);
                Quaternion rotation = Quaternion.CreateFromYawPitchRoll(heading, pitch, roll);
                Quaternion.Concatenate(ref orientation, ref rotation, out orientation);
            }
        }