![]() |
||||||||||||||||||||||||||||
| |
||||||||||||||||||||||||||||
Flash Physics Study | 1 2 3 4 | continued:
So, let's tackle this problem. In a normal iteration of time (when the ball is not hitting the ground, or walls, or ceiling), a ball's velocity and position will change in the following way:
The velocities are simple for the x
and z direction. They don't change. In the y-direction, we need to account
for gravity. Remember from the high school physics class you slept through,
gravity is an acceleration force. Just as velocity represents the change
in distance over time, acceleration represents the change in velocity
over time. So, the equation for y-velocity is errily similar to the equations
for distance, since it changes over time. As for the Gravity constant, in high
school physics, you learned that the gravity of the earth is typically
measured at 9.8 m/s2. That's great and all, but for our Flash purposes,
since we are using pixels as our unit of measurement and frame rate as
our unit of time, 9.8 really isn't a valid representation. We're just
going to leave gravity as a variable that we can change. By letting us
vary it, it makes for some nice effects (lowering the gravity to 0 lets
the balls "float" in air). Also, you might be wondering whether
our gravitational constant should be negative or positive. Well, because
the 0 y-coordinate is defined at the top of the movie, and "positive"
values of y actually fall below the 0 line, we want to define gravity
as a positive constant so that its force causes the ball to fall. Now, we're almost there. We've accounted for the velocity and position changes of the ball under normal conditions. Now, we need to implement a series of boundary cases.
|
No Screenshots Available |
|||||||||||||||||||||||||||
AEvision
Tutorials 2.1 - All rights reserved AEvision
Designs 2002-2007 |
||||||||||||||||||||||||||||
Icons
provided by iconpacks.com |
||||||||||||||||||||||||||||