Game Development Reference
In-Depth Information
v my = v m cos θ y
Thus:
a y = -g
v y = v my + a t = (v m cos θ y ) - g t
Before writing the equation for the y component of displacement, you need to consider
the elevation of the base of the cannon, plus the height of the end of the cannon barrel,
in order to calculate the initial y component of displacement when the shell leaves the
cannon. Let y b be the elevation of the base of the cannon, and let L be the length of the
cannon barrel; then the initial y component of displacement, y o , is:
y o = y b + L cos α
Now you can write the equation for y as:
y = y o + v my t + (1/2) a t 2
y = (y b + L cos α) + (v m cos θ y ) t - (1/2) g t 2
Z Components
The z components are largely analogous to the x components and can be written as
follows:
a z = 0
v z = v mz = v m cos θ z
z = v z t = (v m cos θ z ) t
The Vectors
With the components all worked out, you can now combine them to form the vector
for each kinematic property. Doing so for this example gives the displacement, velocity,
and acceleration vectors shown here:
s = [(v m cos θ x ) t] i + [(y b + L cos α) + (v m cos θ y ) t - (1/2) g t 2 ]
j + [(v m cos θ z ) t ] k
v = [v m cos θ x ] i + [(v m cos θ y ) - g t ] j + [v m cos θ z ] k
a = -g j