﻿ Game Programming Gurus Free JavaScript Editor     Ajax Editor ﻿

Main Page

### The Physics of Linear Momentum: Conservation and Transfer

Now that you have an idea about what momentum is, let's talk briefly about some of the physics involved when an object strikes another. Later I will go into true collision response in more depth, but for now let's keep it simple.

Remember in the game DOOM when you shot a barrel, it would explode and cause the barrels and/or bad guys in the area to move and/or explode? Wasn't that cool splattering a bad guy against a wall! That was just momentum transfer, but believe me, doing it correctly is no picnic!

In general, if two objects collide there are two things that can happen: a perfectly elastic collision and a not so perfectly elastic collision. In a perfectly elastic collision, as shown in Figure 13.10, a ball hits a wall with velocity vi, and when it bounces off it still has velocity vi.. Thus, the momentum was conserved. Therefore, the collision was totally elastic. However, in real life this isn't usually the case. Most collisions aren't elastic, they are less than perfect. When collisions that are less than perfectly elastic occur, some energy is converted into heat, work to deform the objects colliding, etc. Thus the resulting momentum of the object(s) after collision is less than when the collision started.

##### Figure 13.10. A perfectly elastic collision of a ball and wall. However, I'm not interested in this kind of imperfect world. Since we are gods of the virtual world, we might as well make things easy. Hence, I'm going to talk about perfectly elastic collisions in 1-dimension right now, then later we'll do it in 2D and get medieval with the math! Let's begin.

Figure 13.11 has two block objects A, B with mass ma and mb and velocity vai and vbi, respectively. The question is what happens after they hit, assuming no friction (we'll get to that later) and a perfectly elastic collision? Well, let's start with the conservation of momentum. It states that the total momentum before the collision will be the same as after the collision. Or mathematically:

##### Figure 13.11. The collision response of two blocks in 1D. Equation 1: Conservation of momentum

```ma*vai + mb*vbi = ma*vaf + mb*vbf
```

All right, you know ma, mb, vai, and vbi, but you want the final velocities vaf and vbf. The problem is that you only have one equation and two unknowns. This is obviously a bad thing. If you knew the velocity of one of the masses, you could figure the other one out. But, is there a way to figure out both velocities without any further knowledge? The answer is yes! You can use another property of physics to come up with another equation. The property is the conservation of kinetic energy.

Kinetic energy is like momentum, but is independent of direction. It's like a magnitude of sorts that gauges the amount of total energy that a system has. Now, energy is the ability to do work and that's all I'm going to say, we are getting a little too quantum here. However, computing kinetic energy is trivial, the formula is

Equation 2: Kinetic energy

```ke =1/2*m*v2
```

Momentum was just m*v, so you should see that kinetic energy is very similar, but it's always positive and measured in kg*m2/s2, which in the Meter-Kilogram-Second system we just call Joules (J). The cool part is that the kinetic energy of any system is always the same before and after a collision, elastic, or not. Of course you would have to compute the energies lost due to deformation, heat, etc. to account for all the energy, but when assuming a perfectly elastic collision, the kinetic energy before and after can be computed by just knowing the velocities of the objects:

Equation 3: Total kinetic energy of collision

```*ma*vai2 + 1/2*mb*vbi2 = 1/2*ma*vaf2 + 1/2*mb*vbf2
```

Combining this with equation 1 results in:

```ma*vai + mb*vbi      = ma*vaf + mb*vbf
*ma*vai2 + _*mb*vbi2 =1/2*ma*vaf2 + 1/2*mb*vbf2
```

At this point, you have two equations and two unknowns and both vaf and vbf can be computed; however, the math is rather complex, so I will just give you the results:

Equation 4: The final velocities of each ball

```vaf = (2*mb*vbi + vai*(ma – mb))/(ma + mb)
vbf = (2*ma*vai - vbi*(ma – mb))/(ma + mb)
```

Finally, referring back to Figure 13.11, you can figure out the final velocities after the collision of the blocks:

```ma = 2 kg
mb = 3 kg

vai = 4 m/s
vbi = -2 m/s
```

Therefore,

```vaf
= (2*mb*vbi + vai*(ma – mb))/(ma + mb)
= (2*3*(-2) + 4*(2 – 3))/(2 + 3)
= -3.2 m/s

vbf = (2*ma*vai - vbi*(ma – mb))/(ma + mb)
= (2*2*4 – (-2)*(2 – 3))/(2 + 3)
=  2.4 m/s
```

Interestingly enough, object A had so much momentum it turned object B around and they both went off in the positive X direction as shown in part B of Figure 13.11.

What you just did shows how to use momentum and kinetic energy to help solve kinetic/dynamic problems. However, they get much more complex in two and three dimensions. The study of such collisions is called collision response, and it's covered later in the chapter, along with the complete 2D results for perfect and imperfect collisions! For now, though, just think about momentum. ﻿ Ajax Editor     JavaScript Editor