Pathfinding consists of solutions for setting and organizing paths. The set points create the graph on which the paths are searched for.
The state machine is used by MPC (guide cube) to define its behavior. Guide cube controller implements basic logic as switch states and also methods allow moving at the path. States were projected to easily add new behaviors. There are 3 basic states:
- Idle
- Go to
- Follow object
Pathfinding video: youtube.com/hrober/pathfinding
The whole system was used in-game named Errata.
Errata trailer: youtube.com/errata-trailer
Pathfinding main script:
/github.com/Hrober0/Pathfinding-on-graph-with-portals-and-state-machine/Scripts/Pathfinder.cs
State machine controller:
/github.com/Hrober0/Pathfinding-on-graph-with-portals-and-state-machine/Scripts/GCubeController.cs
Folder with states:
/github.com/Hrober0/Pathfinding-on-graph-with-portals-and-state-machine/Scripts/States
- NaughtyAttributes (extension for the Unity Inspector): https://github.com/dbrizov/NaughtyAttributes