Great Fleece | NavMesh AI in Security Guards…!!
To add functionality in Security Guards to move intelligently using NavMesh Agents
These NavMesh Agent added along with the WayPoints System — that adds the functionality of AI in the Security Guard.
Here three waypoints are shown in inspector Point_A, Point_B & Point_C inside the empty GameObject WayPoints these are done through C# API Scripting via defining the variable as below.
public List<Transform> WayPoints.
The three positions of the Security Guard are set at the transform component for each of them (Point_A, Point_B & Point_C)— so that the security guard will start at Point_A (current target =0 )then move to Point_B then to the final destination Point_C following the NavMesh before returning using the below logic.
A coroutine is called waitBeforeMoving() so that the security guard will idle at each of the positions before reaching the final destination and repeat the same process while moving back from the destination to the original position.
Finally, the final AI movement of the Security Guard…!!