Game Development Reference
In-Depth Information
}
CombinedCG = FirstMoment / TotalMass;
Now that the combined center of gravity location has been found, you can calculate the
relative position of each point mass as follows:
for(i=0; i<_NUMELEMENTS; i++)
{
Element[i].correctedPosition = Element[i].designPosition -
CombinedCG;
}
To calculate mass moment of inertia, you need to take the second moment of each
elemental mass making up the body about each coordinate axis. The second moment
is then the product of the mass times distance squared. That distance is not the distance
to the elemental mass centroid along the coordinate axis as in the calculation for center
of mass, but rather the perpendicular distance from the coordinate axis, about which
we want to calculate the moment of inertia, to the elemental mass centroid.
Referring to Figure 1-2 for an arbitrary body in three dimensions, when calculating
moment of inertia about the x-axis, I xx , this distance, r , will be in the yz-plane such that
r x 2 = y 2 + z 2 . Similarly, for the moment of inertia about the y-axis, I yy , r y 2 = z 2 + x 2 , and
for the moment of inertia about the z-axis, I zz , r z 2 = x 2 + y 2 .
Figure 1-2. Arbitrary body in 3D
The equations for mass moment of inertia about the coordinate axes in 3D are:
I xx = ∫ r x 2 dm = ∫ (y 2 + z 2 ) dm
I yy = ∫ r y 2 dm = ∫ (z 2 + x 2 ) dm
I zz = ∫ r z 2 dm = ∫ (x 2 + y 2 ) dm
Let's look for a moment at a common situation that arises in practice. Say you are given
the moment of inertia, I o , of a body about an axis, called the neutral axis , passing through