Game Development Reference
In-Depth Information
each elemental particle is its mass density times its volume. Assuming that the body is
of uniform density, then the total mass of the body is simply the density of the body
times the total volume of the body. This is expressed in the following equation:
m = ∫ ρ dV = ρ ∫ dV
In practice, you rarely need to take the volume integral to find the mass of a body,
especially considering that many of the bodies we will consider—for example, cars and
planes—are not of uniform density. Thus, you will simplify these complicated bodies
by breaking them down into an ensemble of component bodies of known or easily
calculable mass and simply sum the masses of all components to arrive at the total mass.
The calculation of the center of gravity of a body is a little more involved. First, divide
the body into a finite number of elemental masses with the center of each mass specified
relative to the reference coordinate system axes. We'll refer to these elemental masses
as m i . Next, take the first moment of each mass about the reference axes and then add
up all of these moments. The first moment is the product of the mass times the distance
along a given coordinate axis from the origin to the center of mass. Finally, divide this
sum of moments by the total mass of the body, yielding the coordinates to the center of
mass of the body relative to the reference axes. You must perform this calculation once
for each dimension—that is, twice when working in 2D and three times when working
in 3D. Here are the equations for the 3D coordinates of the center of mass of a body:
x c = {∫ x o dm} / m
y c = {∫ y o dm} / m
z c = {∫ z o dm} / m
where ( x , y , z ) c are the coordinates of the center of mass for the body and ( x , y , z ) o are
the coordinates of the center of mass of each elemental mass. The quantities x o dm , y o
dm , and z o dm represent the first moments of the elemental mass, dm , about each of the
coordinate axes.
Here again, don't worry too much about the integrals in these equations. In practice,
you will be summing finite numbers of masses and the formulas will take on the friend‐
lier forms shown here:
x c = {Σ x o m i } / {Σ m i }
y c = {Σ y o m i } / {Σ m i }
z c = {Σ z o m i } / {Σ m i }
Note that you can easily substitute weights for masses in these formulas since the con‐
stant acceleration due to gravity, g , would appear in both the numerators and denomi‐