Conservation of Momentum and Energy


In this section we're going to discuss two physical laws that give us some mathematical relationships that help determine the resultant velocities of two collided objects. But before discussing the laws of conservation of momentum and conservation of energy, we of course need to introduce the concepts of momentum and energy.

Review: What Are Momentum and Energy?

Momentum is a quantity associated with all objects and characterized by an object's mass and velocity. Momentum is a vector whose direction is given by the velocity. Mathematically, this is momentum:

 momentum = mass*velocity  

Usually the variable for momentum is the letter p. Here is an example of how you would use ActionScript to calculate the momentum of something moving in the x direction:

 p = mass*xmov  

Momentum is not too difficult to conceptualize. Imagine a 100-pound man and a 200-pound man running at the same velocity. Common sense tells you that the 200 pound man has more momentum. But now you can prove that with the equation above. The 200-pound man has twice the momentum.

Energy is a little bit more difficult to explain, even though we are all familiar with it in various everyday forms. It is the measure of a system's ability to do work. Energy is classified into two main categories: kinetic energy and potential energy. Kinetic energy (which is all we will use in this chapter and indeed the whole book) is the energy associated with the movement of an object. Potential energy is the energy stored in an object that can be converted to kinetic energy. This includes the energy stored in an object raised off the ground (gravitational potential energy), electrical energy, nuclear energy, and chemical energy.

Kinetic energy is dependent on an object's mass and speed. Mathematically, here is the kinetic energy of an object:

 kinetic energy = (½)*mass*speed2  

Kinetic energy is usually represented by E, KE, or T (don't ask me why). We will use KE or ke to represent kinetic energy. Here is an example of how the above equation would be written in ActionScript:

 ke = (½)*mass*speed*speed  

The Conservation Laws

Now that we've introduced momentum and energy, it is time to spell out the simple laws of conservation of momentum and conservation of energy. Basically, these laws, or rules, state that the quantities of momentum or of energy will not actually change in the course of a collision. (In other words, in this case the word conserve simply means "doesn't change.") Let's start with momentum. The momentum of an object (or system) is conserved if the total force on it is 0. As an example, consider two billiard balls moving toward each other. Ball1 has the momentum p1_initial, and ball2 has the momentum p2_initial. If we sum these two momentums, then we get the total momentum before the collision, P_initial. After the balls collide and rebound, each has a new momentum p1_final and p2_final. If we sum these two momentums, we get P_final. According to the conservation law for momentum, the total momentum after the collision is the same as the total momentum before the collision (if there is no net external force acting on the system, such as wind). If this condition is met, then P_initial = P_final.

graphics/06fig08.gif

graphics/hand_icon.gif

It is important to note that we are talking about elastic collisions here. In elastic collision, both kinetic energy and momentum are conserved. We aren't going to get into inelastic collisions, in which only momentum is conserved (for example, rain sticking to a ball in the air, hence changing the mass of the object).


The billiard-ball example given above describes the most common and likely use you'll have for applying this conservation law: the collision and rebound of two objects. This law applies to other types of events as well, events involving individual objects dividing into pieces (for example, a stage separating from its base rocket ship, or a plate breaking). We aren't going to cover those here, because they are not commonly used in Flash games.

Like momentum, energy is conserved when the final energy is equal to the initial energy. There is a more complicated definition for the energy-conservation law, but it includes some concepts that take a lot of explanation. It should be assumed that in all of the cases we deal with in this book, the total energy at the instant before a collision is the same as the energy at the instant after the collision. Let's use the same billiard-ball example to spell this out. The sum of the kinetic energy of each ball before the collision ke1_initial and ke2_initial is KE_initial. The sum of the kinetic energy of each ball after the collision ke1_final and ke2_final is KE_final. The law of the conservation of energy tells us that the final kinetic energy is the same as the initial energy, so KE_initial = KE_final.



Macromedia Flash MX Game Design Demystified(c) The Official Guide to Creating Games with Flash
Macromedia Flash MX Game Design Demystified: The Official Guide to Creating Games with Flash -- First 1st Printing -- CD Included
ISBN: B003HP4RW2
EAN: N/A
Year: 2005
Pages: 163
Authors: Jobe Makar

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net