Executing FSM actions
Now we need to complete 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 base or the player). We will be handling movement with the 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 NavMesh
- Using Pathfinding
- Adding final details
Let’s start by preparing our scene for movement with Pathfinding.
Calculating our scene’s NavMesh
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 extracted from...