Game Development Reference

In-Depth Information

c
dhinge
=
u
(1)

n
(2)
=
0

,

n
(2)

·

v
(1)

·

0

c
dhooke
=
u
(1)

v
(2)

·

=0
.

We use the Hooke joint here for rough comparison since it is not practical to define

the CV joint with dot products. Now, choose body 2 to be the universe and rotate

body 1 about
u
(2)
by
π
so both the new
v
(2)
and
n
(2)
axes have reversed signs.

Clearly, all three constraints are now violated geometrically, despite the fact that

the indicator functions are still 0.

This is not the case with the quaternion-based constraints defined in Equa-

tions (9.2) and (9.4) since for a rotation that flips the axis
z
by 180
◦
—
q
(2)
=

[0
,
1
,
0
,
0]
T
, say—the indicators are then
c
lock
=[1
,
0
,
0]
T
and
c
hinge
=[1
,
0]
T
,

respectively. For the CV joint, the rotation that flips the axis
x
corresponds to

q
=[cos(
π/
2)
,
0
,
0
,
sin(
π/
2)]
T
=[0
,
0
,
0
,
1]
T
,giving
c
CV
=1.Theseareall

maximum violation given that all constraints correspond to components of unit

quaternions. Thus, the Jacobians at these points are then

⎡

⎤

00 0

00

G
(2)

⎣

⎦
,

dlock
=

1

01 0

−

dhinge
=
00

,

1

00 0

−

G
(2)

dhk
=
000
,

respectively, and so the restoration force vanishes at maximum violation. Since

the Jacobians have full row rank when the constraints are satisfied, some of the

rows must decrease gradually on the path to maximal constraint violation and so

the constraint weakens. This problem can be addressed by adding nonlinear terms

in the constraint definitions. That's beyond the present scope, however.

G
(2)

9.8 More General Frames

Of course, we may not always have hinge joints that align the axis
z
of body 1

with the axis
z
of body 2. Changing that is quite easy to do in the dot product

version, but there are a few additional tricks for the quaternion counterpart, as I

now show.

Assume now that the body-fixed reference frames in which the joints are de-

fined have quaternions
e
,
f

∈
H

, respectively. Figure 9.4 demonstrates the situa-

tion for body 1 and transform
e
.