Game Development Reference

In-Depth Information

The indicator is easy to define here:

c
lock
=
q
v
=

P

q
=
P
lock
q
=0
,

(9.2)

where

P

=
P
lock
is the projection operator

⎡

⎤

0100

0010

0001

⎣

⎦

P

=

so that

P

q
=
q
v
.

There is still an ambiguity since the constraint is satisfied by both

q
.Butthat

is of no consequence since both cases correspond to a unit rotation. Remember

that quaternions cover the rotation group twice. The lock constraint is thus a

simple linear projection of the relative quaternion. That will hold for all the other

constraints.

The hinge constraint requires that the original and transformed frame share a

common axis. This is set to the axis
z
arbitrarily, and thus the allowed rotations

have the form

±

q
v
=[0
,
0
,
sin(
φ/
2)]
T
,

q
s
=cos(
φ/
2)

and

(9.3)

which gives the two equations we want:

c
hinge
=
x
·
q
v

=
x
T

y
T

q
=
P
hinge
q
=
0

,

P

(9.4)

y
·
q
v

0

where

P
hinge
=
x
T

y
T

=
0100

0010

P

is the hinge projection operator. We'll see in Section 9.8 how to define this for

axes other than
z
.

And now comes the CV joint. The kinematic constraint we want to create here

is such that the rotational motion along the axis
n
(1)
of an object produces an

identical rotation about the axis
n
(2)
of another. That is precisely the relationship

between the plate of a turntable and the disc sitting on it, although these two

objects share the same longitudinal plane. But the idea is the same: we want a

driver that produces a constant rotational velocity in a secondary body about some

axis fixed in that body.

Let's now visualize a perfect CV joint using two pens with longitudinal axes

n
(1)
and
n
(2)
, respectively, each with a longitudinal reference line drawn on the