Game Development Reference
In-Depth Information
Figure 1-6. Sphere: I xx = I yy = I zz = (2/5) mr 2
Figure 1-7. Spherical shell: I xx = I yy = I zz = (2/3) mr 2
As you can see, these formulas are relatively simple to implement. The trick here is to
break up a complex body into a number of smaller, simpler representative geometries
whose combination will approximate the complex body's inertia properties. This exer‐
cise is largely a matter of judgment considering the desired level of accuracy.
Let's look at a simple 2D example demonstrating how to apply the formulas discussed
in this section. Suppose you're working on a top-down-view auto racing game where
you want to simulate the automobile sprite based on 2D rigid-body dynamics. At the
start of the game, the player's car is at the starting line, full of fuel and ready to go. Before
starting the simulation, you need to calculate the mass properties of the car, driver, and
fuel load at this initial state. In this case, the body is made up of three components: the
car, driver, and full load of fuel. Later during the game, however, the mass of this body
will change as fuel burns off and the driver gets thrown after a crash! For now, let's focus
on the initial condition, as illustrated in Figure 1-8 .
Search Nedrilad ::

Custom Search