Game Development Reference
In-Depth Information
We can also express t
e
, h, and d in terms of s
0
and θ:
t
a
= − y
0
/g = −(s
0
sinθ)/g
= −s
0
(sinθ)/g,
Important quantities in
projectile motion,
expressed in terms of
launch angle and speed
t
e
= −2 y
0
/g = −2(s
0
sinθ)/g
= −2s
0
(sinθ)/g,
= −2s
0
(sinθ)(cosθ)/g,
d = −2 y
0
x
0
/g = −2(s
0
sinθ)(s
0
cosθ)/g
h = −(1/2) y
0
/g = −(1/2)(s
0
sinθ)
2
/g
= −s
0
(sin
2
θ)/2g.
These equations are highly practical because they directly capture the re-
lationship between the “user-friendly” quantities of launch speed, launch
angle, flight time, and flight distance.
At this point, let's pause to make an interesting observation about the
relationship between the initial speed s
0
and the horizontal distance trav-
eled d. It's a quadratic relationship, meaning when we increase s
0
by a
factor of k, we increase d by a factor of k
2
. It might seem more natural for
the relationship to be linear, meaning that d would increase by the same
factor k. We can understand the quadratic relationship by breaking the
initial velocity into its horizontal and vertical components, denoted earlier
as x
0
and y
0
, respectively. It's not di
cult to see that increasing x
0
will
increase d by the same factor. Less obvious is that the same is true for y
0
.
This is true because the duration that the object is airborne is proportional
to y
0
. So if we increase the vertical velocity, we give the object more time
to travel. Thus any scale factor we apply to s will affect the distance twice,
once as a result of the increased ground velocity due to x
0
, and again as
a result of the increased travel time due to y
0
. This produces a quadratic
relationship between s and d.
Now let's return to a question we put on hold from earlier: how might
we determine the point of impact for any arbitrary vectors ∆
p
,
a
, and
v
0
?
We said before that the key was to “choose a direction” and solve a one-
dimensional problem in that direction. If a cardinal direction is chosen, we
just throw out the other coordinates. For an arbitrary direction, we project
the problem onto a line in that direction. Any component of displacement,
velocity, or acceleration perpendicular to that line is discarded during the
projection. We learned how to project onto a line and measure displace-
ment in a particular direction by using the dot product in Section 2.11. All
that is left is to select a direction.
Assuming the projectile hits the target, we will get the same value for
t no matter what direction we choose. But that doesn't mean the choice is
irrelevant. For example, in the ball-bearing example, it would be a disaster
to chose the +x or +z directions, since there is no acceleration in either
of those directions and application of Equation (11.17) would result in a
division by zero. This suggests the strategy of simply using
a
itself as the
direction of projection. To do this, we dot each vector quantity with
a
,
Search WWH ::
Custom Search