Game Development Reference

In-Depth Information

Taking the derivative of
q
t
with respect to
t
gives us

d
q
t

dt

=
d
exp(
t
log
q
)

dt

=log
q
exp(
t
log
q
)

= log
q
)
q
t
.

At
t
=0,thisisjust

d
q

dt

=log
q

=
0
,
θ

2
r
.

Pulling out the
2

term, we get

1

2
(0
,θ
r
)=
1

2
w
.

Multiplying this quantity by the quaternion
q
gives the change relative to
q
,just

as it did for matrices.

1.6.6 Numerical Integration for Angular Velocity

As angular velocity and torque/angular acceleration are both vectors, we might

think we could perform the followoing:

ω
i
+1
=
ω
i
+
h
I
−
1
τ.

However, as

τ
=
I
ω
+
ω

×

I
ω,

we cannot simply multiply
τ
by the inverse of
I
anddotheEulerstep.

One solution is to ignore the
ω

I
ω
term and perform the Euler step as written

anyway. This term represents the precession of the system—for example, a tipped,

spinning top will spin about its local axis but will also slowly precess around its

vertical axis as well. Removing this term will not be strictly accurate but can add

some stability.

The alternative is to do the integration in a different way. Consider the angular

momentum
L
instead, which is
I
ω
. The derivative
L
=
I
ω
=
I
α
=
τ
. Hence we

can do the following:

×

L
i
+1

=
L
i
+
hτ,

I
−
i
L
i
+1
.

ω
i
+1

=