Chapter 16. Physics for Prediction
Accurate shooting can be understood as a combination of many skills. One of these is the ability to predict what's going to happen in the near future. This involves anticipating player movement, as well as understanding the ballistics of the projectile. We'll focus on this aspect of shooting in this chapter.
Throughout the explanations, we'll assume that the aiming can be done satisfactorily by just turning toward the estimated target. (Matching pitch and yaw angles is often good enough.) The weapon is fired whenever it's ready—with an enemy present of course! The target selection itself is done implicitly as part of the prediction; the predicted outcome becomes the target.
In the quest to find the best place to launch a projectile at an enemy, this chapter covers the following topics:
By the end of the chapter, we'll have an animat capable of firing a weapon (with slow projectiles) to intercept a moving enemy.