Game Development Reference
In-Depth Information
Finally, the resultant force is accumulated in the total force vector variable, and we
calculate the moment by taking the cross product of the element coordinate vector with
the resultant force. The resulting moment is accumulated in the total moment vector
variable. After exiting the loop, the function adds the thrust vector to the total force.
So far, all of these forces and moments have been referenced in the body-fixed-
coordinate system. The only thing left to do now is apply the gravity force, but this force
acts in the negative y-axis direction in the earth-fixed-coordinate system. To apply the
gravity force, the function must first rotate the body force vector from body space to
earth space coordinates. We used a quaternion rotation technique in this example, which
we already discussed in Chapter 11 and Chapter 12 .
That's pretty much it for the flight model. We encourage you to play with the flight model
in this program. Go ahead and tweak the element properties and watch to see what
happens. Even though this is a rough model, the flight results look quite realistic.
Search Nedrilad ::

Custom Search