Game Development Reference
Figure 9.4. Attachment frames.
The quaternions that map vectors defined in these frames to the global frames
are then in world frame, so we have
re and sf ,
respectively. This changes the definition of the relative quaternion in Equation (9.9)
p = e † r † sf .
Following the steps in Equations (9.9) and (9.10), we get
p = e † qf
= P ( f ) Q ( e ) T q .
Everything else follows. To define a hinge joint, for instance, we can either spec-
ify the quaternion transforms e and f directly or provide a hinge frame containing
at least the axis of rotation in world coordinates. If we have a full frame of ref-
erence for the hinge definition, it is possible to define the reference joint angle
also. Otherwise, the orthogonal complement of the axis must be computed and
the quaternions e , f extracted from the frame.
Once we have a full frame defining the hinge geometry in world coordinates
with three orthogonal axes, u , v , n , forming an orthonormal basis in which n is
the axis of rotation, we build the matrix
R = uvn