Adding Behavior and Interaction
Welcome to Chapter 9! In the previous chapter, we took a deeper look into collision detection. After a discussion about the complexity of finding colliding instances in the virtual world, we explored ways to speed up the collision search by adding world partitioning and model simplifications. Then, we implemented a quadtree to split up the world into smaller areas, and we added bounding boxes and bounding spheres for the instances. Finally, we used both the quadtree and the instance boundaries to detect a collision between instances.
In this chapter, we will add some sort of “real-life” behavior to the instances, giving them the ability to walk around the virtual world by themselves and react to events like the collisions we added in the previous chapter. First, we will take a brief look at behavior trees and state machines and how both works. Then, we will add a visual editor to visually represent the state machines of the instances...