Game Development Reference
In-Depth Information
the end of a bullet's flight, let's revisit the beginning. Earlier we talked about recoil as
the result of Newton's conservation of momentum . Everyone has seen a cheesy movie
where the hero shoots the bad guy and the bullets cause the bad guy to be blown off his
feet. There is a big problem with this! If the bullets were powerful enough to knock the
person they hit off his feet, then the person shooting the gun would also be blown off
his feet! In reality, the force felt by the person being shot is nearly the same as the force
felt when the weapon recoils. For a 9 mm bullet weighing 7.45 g and leaving the barrel
at 390 m/s, the gun will experience recoil such that its momentum is equal to the moment
of the bullet.
One interesting way to incorporate recoil into a video game is in space. On Earth, a gun's
recoil is pretty quickly transferred to the ground by friction between the player and the
big bad earth. In space, the shooter has no planetary body to push against, so the recoil
of the gun becomes the recoil of the gun/person system. Next time your character needs
to move from one ship to another in a micro-gravity environment, you can make her
spend some ammo to get herself moving.
Now, if you get shot you will probably fall down pretty quickly, but this has more to do
with biology than physics. However, ignoring living targets, if you want to simulate the
damage done by a bullet hitting something, it is more important to look at the bullet's
kinetic energy. In fact, bullets and artillery shells are called kinetic weapons , as their
primary means of destroying a target is by transferring their kinetic energy to the target.
This is different than, say, a bomb that transfers its chemical energy into heat and kinetic
energy after impact.
Explosions
Accurately modeling explosions involves multiphysics fluid simulations like the kind
discussed in Chapter 14 through Chapter 16 . One of our pet peeves is that video games
usually have a collection of barrels lying around that, if shot once, explode violently
enough to blow up nearby vehicles. While this makes for an easy out against multiple
enemies, it is actually pretty hard to get everyday objects to blow up. Shooting a gas can
with a handgun will almost never result in a fire, much less an explosion. Indeed, even
shooting a propane tank with a rifle won't give you fireworks. It would take something
like a tank of 1/4 propane mixed with 3/4 oxygen to explode, and those aren't usually
lying around. Regardless, when we play video games we're often thankful that we have
an occasional red barrel to shoot, so we'll review how to make the resulting explosion
more accurate even if the ignition is improbable.