Part 7: Shark NPC

Christiane Snyder
8/21/2016

Now we’re getting to the interesting part. The game isn't very challenging, so we'll some obstacles.

We’ll now add a Shark NPC that will chase after the main fish if it gets within range.

In the previous section, we added modifications to our code to make sure that the camera and connected fish did not pass through the ground plane. We’ll add in the same safeguards on this NPC, but we’ll also tack on a few extra lines of code that will adjust the shark’s rotation over time (allowing it to move off and away from the ground plane).

Note: will also check if the shark is going too far up and if it is, its forward vector will be rotated down overtime until it’s Y value (height) is below the upper bound(50.0f).