Game Development Reference
In-Depth Information
4
T HE P ARTICLE
P HYSICS E NGINE
ment of particles under gravity.
Considering that it is such a simple piece of code, I've spent a long time talking
about the theory behind it. This will become important later in this topic when we
repeat the same kind of logic for the rotation of objects.
At the moment our engine is fairly limited. It can only deal with isolated parti-
cles, and they cannot interact in any way with their environment. Although these are
serious limitations that will be addressed in the next part of the topic, we can still do
some useful things with what we have.
In this chapter we will look at how to set up the engine to process ballistics: bullets,
shells, and the like. We will also use the engine to create a fireworks display. Both of
these applications are presented in skeleton form here, with no rendering code. They
can be found with full source code on the CD.
We now have our first working physics engine capable of simulating the move-
4.1
B ALLISTICS
One of the most common applications of physics simulation in games is to model
ballistics. This has been the case for two decades, predating the current vogue for
physics engines.
In our ballistics simulation, each weapon fires a particle. Particles can represent
anything from bullets to artillery shells, from fireballs to laser-bolts. Regardless of the
object being fired, we will call this a “projectile.”
Search Nedrilad ::




Custom Search