Game Development Reference
in orientation at each time step throughout the simulation. Thus, you can see that you
must have a means of relating the rotation matrix to angular velocity so that you can
update the orientation accordingly. The formula you need is as follows:
d R / dt = Ω R
Here, Ω is a skew symmetric matrix built from the angular velocity vector components
Notwithstanding a rigorous proof of this relation, it's easy to see its beauty, which is that
you can differentiate the rotation matrix by simply matrix multiplying by the angular
velocity (in the form of Ω ). In a simulation you'll know your initial rotation matrix, and
you'll calculate the angular velocity at each time step; thus, you can easily progress, or
integrate, the rotation matrix.
You should be able to see here that since you'll only explicitly calculate the rotation
matrix once and will update it with a matrix multiply, you won't have to use computa‐
tionally expensive trigonometric functions during each time step. Further, you avoid
the singularity problem mentioned in the introduction to this chapter.
It should also be obvious that you gain these benefits at some price. First, you have to
deal with nine parameters in the rotation matrix (each element in the 3×3 rotation
matrix) to represent three angular degrees of freedom. Secondly, in order to do that,
you need to impose constraints on the rotation matrix; specifically, you need to enforce
the constraint that the matrix be orthogonal with a determinant of 1 so that it satisfies
the following (each column in the matrix represents a unit vector, and they are all at
right angles to each other): 1
R T R = I
Here R T is the transpose of R , and I is the identity matrix. Due to numerical errors such
as roundoff and truncation, you'll have to enforce this constraint very often in your
simulation. Otherwise, your rotation matrix will do more than rotate your objects, it
may scale or translate them too.
Instead of dealing with nine parameters and trying to constrain six degrees of freedom
so that only the three you want can be represented, you could take an alternative ap‐
1. Two vectors are orthogonal if their dot product is 0.