i know that quaternions don't experience gimbal lock.

but if you convert quaternions to eulers probably you have to check if the resulting eulers will have some kind if gimbal lock problem? i came across quaternion->euler conversion examples which did gimbal lock checks.

<edit>hm... i think i noticed some jittering now in very rare cases. looks like there has to be some kind of gimbal lock check like that:

Code:
	float st = -2 * (q.w*q.y - q.x*q.z);

if(fabs(st) > 0.9999)
{
draw_text("gimbal lock!", 10, 10, vector(255,255,255));

// but i have no clue what belongs here

}
else
{
entity->pan = RAD2DEG * atan2f(2 * (q.w*q.z + q.x*q.y), (1 - 2 * (q.y*q.y + q.z*q.z)));
entity->tilt = RAD2DEG * asinf(st);
entity->roll = RAD2DEG * atan2f(2 * (q.w*q.x + q.y*q.z), (1 - 2 * (q.x*q.x + q.y*q.y)));
}

</edit>