Math and physics › Angles and rotations
Rotations in 3D: Euler angles and quaternions
Know first: Matrices: new axes, not a table of numbers
A rotation in 3D can be written as three angles, a matrix, an axis with an angle, or the four numbers of a quaternion. Angles are easy for a person to read, but they sometimes lock up, and they blend along awkward paths. A quaternion cannot be read by eye, yet it chains and blends rotations without either problem. This page explains why, and builds the quaternion from scratch with no higher math.
Why this matters
Rotations are everywhere in a game: a turret aims at its target, a camera follows the hero, a skeleton blends two animations. Three angles cause odd behavior. The camera tumbles when it looks straight up, a turret spins the long way around, and a hand in an animation swings off along an arc. So engines store rotations as quaternions internally and show angles only in the properties window. To see what happens between the two, you need the lessons on matrices, sine and cosine and interpolation.