Executing FSM actions
Now, we need to do the last step—make the FSM do something interesting. Here, we can do a lot of things, such as shoot the base or the Player and move the Enemy toward its target (the Player or the base). We will be handling movement with a Unity Pathfinding system called NavMesh
, a tool that allows our AI to calculate and traverse paths between two points while avoiding obstacles, which needs some preparation to work properly.
In this section, we will examine the following FSM action concepts:
- Calculating our scene's Pathfinding
- Using Pathfinding
- Adding the final details
Let's start by preparing our scene for movement with Pathfinding.
Calculating our scene's Pathfinding
Pathfinding algorithms rely on simplified versions of the scene. Analyzing the full geometry of a complex scene is almost impossible to do in real time. There are several ways to represent Pathfinding information that's been extracted...