< Day Day Up > |
Equations of MotionNow that we've defined all the variables you'll be working with, you can move on to studying the equations that model one-dimensional motion. It is very important to note that these equations hold only when the acceleration is constant. Remember that the velocity section started by discussing constant velocity. It said that if the velocity does not change, the average velocity is the same as the instantaneous velocity at any time. The same applies to acceleration. Fortunately, most objects in nature move with a constant acceleration, like an object in free fall. If you have a scenario in which the acceleration changes, just break it into smaller time intervals of constant acceleration. This works perfectly in programming, because you address motion on a frame-by-frame basis, so within one frame you're sure to have a small-enough time interval for constant acceleration. NOTE To make the equations simpler, we'll use t to represent the entire time interval rather than (tf ti). Let's start with the definition of acceleration: If we do a little algebraic rearranging (multiply both sides by t and add vi), we'll get the first equation of motion.
Remember that in this chapter you are working with constant acceleration. Because velocity is increasing or decreasing uniformly with time, you know that the average velocity over a time interval equals the average of the initial velocity, vi, and the final velocity, vf. This gives us the second equation.
The first section of this chapter defined average velocity as displacement over time: Equation 2 also gives you a formula for average velocity as long as the acceleration is constant. If you set the two equal to each other, you get the following: A little bit of algebra reveals equation 3:
Now let's take equation 1 (vf = vi + at) and substitute it into equation 3 for vf: Dx = ½(vi + vi + at)t Dx = ½(2vi + at)t Dx = (vi + ½at)t Dx = vit + ½at2
The final equation can be derived by another combination of equations 1 and 3. If you solve equation 1 for time (t = (vf vi)/a) and then plug it into equation 3, you get the following:
These five equations can help you solve any problem related to one-dimensional motion with constant acceleration. Remember that they are all derived from the definitions of velocity and acceleration. The best way to become familiar with them is to work through some examples. A great way to approach 1D motion with constant acceleration is to follow these steps:
At this point, if you know the actual values, you can plug them into the equation and solve for the one you're looking for. If it's a programming situation and you're expecting values to be provided as the game progresses, simply use your rules of algebra to rearrange the equation you've chosen to solve for the variable you're looking for, as shown in Table 8.1.
NOTE The second equation might not be used very often, but it serves as a great reminder that average velocity is not the same as instantaneous velocity (unless a = 0). Example 8.7: Race CarSuppose you're driving along and you're forced to slam on the brakes. If you're going 50mi/hr when you apply the brakes, and you know the brakes can decelerate the car at a rate of 6.5m/s2, how much time will it take to stop? Solution
Example 8.8: Race Car RevisitedSuppose you're in the same situation as in Example 8.7, and you realize the car you're about to hit is stopped about 10 meters away. Will you be able to stop in time? Solution
Notice that the last two examples started out with the same information but ended quite differently. Always be clear about what you're looking for, because that determines which equation you use. Also, be careful with the units. Remember that they must be consistent before you can plug values into the equations. You can even carry the units through the calculations and use them as a double check. If the units make sense for the quantity you're looking for, chances are you did the algebra correctly. In the last example, you were looking for displacement and you ended up with meters for the units, which makes sense. Let's look at a slightly more complicated example. Example 8.9: Using More Than One EquationSuppose you're driving along a straight highway. You look at the speedometer, and it reads 45mi/hr just before you hit the gas. If you know the car accelerates at a rate of 2m/s2, how long will it take to go 0.25 miles? Solution
There is usually more than one way to solve every problem, so allow yourself to be a little creative. Any time you want to avoid using a particular equation, you can simply bypass it by using two others. So far, we've only talked about horizontal one-dimensional motion. These same equations can be used for vertical one-dimensional motion as well. Just replace Dx in all the equations with Dy. One additional detail applies to vertical motiongravity. On Earth, all objects fall to the ground with the same acceleration due to gravity (if you ignore air resistance). That gravitational constant is g = 9.8m/s2 = 32.1ft/s2. In the five equations of motion, you can now substitute g or 9.8m/s2 for a any time the motion is vertical. The negative sign in front indicates that the direction is downward. Let's look at an example. Example 8.10: Vertical MotionSuppose your game has a monster that drops rocks from a raised platform. How long would it take for a rock to fall 50m to the ground? Solution
As you can see, vertical 1D motion works the same way as horizontal 1D motion. This section opened with five equations that can be used to describe one-dimensional motion. The next chapter closely looks at both velocity and acceleration. The following chapter expands these concepts into two and three dimensions. Self-Assessment
|
< Day Day Up > |