Quaternion Rotation around Local Axis

What would be the simplest way of rotating an object around his LOCAL axes using 3 Quaternions for each axis as an absolute rotation?

I need this for an airplane rotation. I have the absolute rotations for each axis as:

Quaternion yaw;
Quaternion pitch;
Quaternion roll;

I can’t do:

transform.rotation = yaw * roll * pitch;

Because that would combine the rotations according to worldspace, as discussed here

Would I have to apply the yaw rotation first, then recalculate and apply the roll rotation, then recalculate and apply the pitch rotation? What would be the best way to do this?

Thanks for your thoughts!

Why not just use eulerAngles? http://unity3d.com/support/documentation/ScriptReference/Transform-eulerAngles.html for example

The big problem here is: in a real airplane, all rotations that you apply refer to the airplane local axes, but when combining rotations the combination order modify this - the first rotation refers to the world axes (since no rotation was applied yet), the second use the axes rotated by the first rotation, and only the 3rd will be totally local, since the other axes were already rotated (side note: rotations run right to left, so the rightmost quaternion applies the first rotation).

To mimic a real airplane, you should apply the rotations incrementally to the current object rotation - maybe using the old Rotate, like this:

float yawSpeed = 10f;
float rollSpeed = 15f;
float pitchSpeed = 12f;

void Update(){
    float y = Input.GetAxis("Mouse X")*yawSpeed*Time.deltaTime;
    float r = Input.GetAxis("Horizontal")*rollSpeed*Time.deltaTime;
    float p = Input.GetAxis("Vertical")*pitchSpeed*Time.deltaTime;
    transform.Rotate(p, y, r); // Rotate uses Space.Self as default
}

This works fine when someone is handling the controls, but may fail if used by AI because the accumulation of small errors over time lead to weird results: the angles don’t return to zero, or rotation from one axis “leaks” to the others.