Working with Unity FSM
Now that we have an proper understanding on the FSM’s basic controls we can further push the boundaries by adding the ability to make the Ai Sphere jump from one platform to another linked platform. We can achieve this by using Unity’s Off mesh Link setting and string two platforms together.
Since we have already baked the area which the AI can walk on, if we were to extend one platform with a space/gap between them, all while adding an additional waypoint on the other side. We will see that the AI sphere will never make it to the new waypoint and Unity will report an error. To fix this we will need to adjust one setting withing the Inspector.
Adding the Off Mesh Link:
To link the two platforms together, we first add an “Off mesh Link” component to the new platform.
This will make Unity identify the platform as part of the same walkable boundary as the rest. Next we are going to add in the start and end transform components. For this situation the waypoints are going to be the controlling factor where the Start will be waypoint F and the end point is waypoint G.
The Auto Update Position checkbox is also checked, but that is only used if the platforms are moving. If the checkbox isn’t selected then the position of the waypoints will stay the same and when the AI sphere were to jump back to the previous platform, then they will only track the last updated position.
Once we have the Start and End point placed, we can test out the results, and Unity and the AI sphere will automatically shift from one waypoint to the next and back. This is how useful the Off Mesh Link component can be applied on various platforms in the NavMesh.