Game Development Reference

In-Depth Information

Note that because of the presence of the products of inertia, the direction of the

torque vector
τ
is not necessarily the same as the angular acceleration vector
θ
. If the

products of inertia are all zero,

⎡

⎤

I
x
00

0
I
y
0

00
I
z

⎣

⎦

I

=

and the torque vector is in one of the principal axis directions—X, Y, or Z—then the

acceleration
will
be in the direction of the torque.

Many shapes have easy formulae for calculating their inertia tensor. A rectangular

block, for example, of mass
m
and dimensions
d
x
,
d
y
,and
d
z
aligned along the X, Y,

and Z axes, respectively, has an inertia tensor of

⎡

⎤

12
m(d
y
+

1

d
z
)

0

0

⎣

⎦

1

I

=

0

12
m(d
x
+

d
z
)

0

12
m(d
x
+

1

d
y
)

0

0

A list of some other inertia tensors for common shapes is provided in appendix A.

The Inverse Inertia Tensor

For exactly the same reasons as we saw for mass, we will store the inverse inertia tensor

rather than the raw inertia tensor. The rigid body has an additional member added,

a
Matrix3
instance:

Excerpt from include/cyclone/body.h

class RigidBody

{

// ... Other RigidBody code as before ...

/**

* Holds the inverse of the body's inertia tensor. The inertia

* tensor provided must not be degenerate (that would mean

* the body had zero inertia for spinning along one axis).

* As long as the tensor is finite, it will be invertible.

* The inverse tensor is used for similar reasons as those

* for the use of inverse mass.

*

* The inertia tensor, unlike the other variables that define

* a rigid body, is given in body space.

*

* @see inverseMass

*/