HTML and CSS Reference
In-Depth Information
Conservation of Momentum
By now you should be familiar with collisions. You've read an entire chapter on collision detection and
even faked some collision reactions between two objects. Conservation of momentum is the exact
principle you need to respond realistically to a collision.
Using the conservation of momentum, you can determine how objects react after a collision, so you can
say: “This object moved at velocity A and that object moved at velocity B before the collision. Now, after
the collision, this object moves at velocity C and that object moves at velocity D.” To break it down further,
because velocity is just speed and direction, if you know the speed and direction of two objects just before
they collide, you can figure out the speed and direction they will move in after the collision. This is a useful.
But there's a catch: You need to know each object's mass. So, what this means is that if you know the
mass, speed, and direction of each object before the collision, you can figure out where and how fast the
objects will go after they collide.
That's what conservation of momentum can do for you—but what is it? The Law of Conservation of
Momentum is a fundamental concept of physics that says the total momentum for a system before a
collision is equal to the total momentum after a collision. But what is this system the law refers to? This is
just a collection of objects with momentum. Most discussions also specify that this is a closed system,
which is a system with no other forces or influences acting on it. In other words, you can just ignore
anything but the actual collision itself. For our purposes, we always consider just the reaction between two
objects, so our system is always something like object A and object B.
The total momentum of the system is the combined momentum of all the objects in the system, so for us,
this means the combined momentum of object A and object B. If you combine the momentums before the
collision and combine the momentums afterward, the result should be the same.
Before we jump into the math, here's a suggestion. Don't worry too much about trying to figure out how to
convert this to real code—we get to that soon enough. Just try to look at the next few formulas from a
conceptual viewpoint, “This plus that equals that plus this.” It translates neatly into code by the end of this
chapter.
If combined momentum before and after the collision is the same, and momentum is velocity times mass,
then for two objects—object 0 and object 1—you can come up with something like this:
momentum0 + momentum1 = momentum0Final + momentum1Final
or
(m0 × v0) + (m1 × v1) = (m0 × v0Final) + (m1 × v1Final)
To find the final velocities for object 0 and object 1, they are v0Final and v1Final . The way to solve an
equation with two unknowns is to find another equation that has the same two unknowns in it—and it just
so happens there is such an equation floating around the halls of the world's physics departments. It has
to do with kinetic energy. You don't have to know, or even care, what kinetic energy is about, you just
borrow the formula to help you solve your own problem and be done with it. Here's the equation for kinetic
energy:
KE = 0.5 × m × v 2
 
Search WWH ::




Custom Search