Game Development Reference
and extract the quaternion t from it using well-known techniques [Shoemake 10].
Once you have that, you compute
e = r † t
f = s † t ,
where r and s are the orientation quaternions of body 1 and 2, respectively.
For the CV joint, the axis of rotation may be different in each body. For that
case, we need two axes or two frames, as before. A full frame helps to define
the zero reference, as for the hinge case. The computations are the same as in
Putting everything together, we can now define the general constraints and
constraint Jacobians in a unified way using three different projection operators P
acting on the relative quaternion q . The meta definition is this:
c ( x )= Pq ,
G (1) =
T ( q ) ,
G (2) =
T ( q ) .
In turn, the different constraints have the following projection operators:
P hinge = x T
P lock =
( f )
( e ) ,
P CV = z T
( f )
( e ) .
These projection matrices need to be computed only once, unless we have limits
and drivers, as I explain in the next section.
9.9 Limits and Drivers
The hinge joint leaves one degree of freedom. Good or bad, even this freedom
is sometimes taken away with joint limits, locks, or drivers. Going back to the
definitions in Equations (9.4) and (9.3), we can compute the angle from
θ = 2 atan( q s /q 3 ) .
This is now a scalar function of the vector argument q ,
θ =2 f ( g ( q )) ,