The NavMeshAgent component that we added to Sphere-arrow GameObject does most of the work for us. NavMeshAgents need two things:
- A destination location to head towards
- ANavMesh component of the terrain with walkable/non-walkable areas, so that it can plan a path by avoiding obstacles
We created two obstacles (the Cube-wall objects), and these were selected when we created the NavMesh for this scene in the Navigation panel. When the Navigation panel is displayed, at the same time in the Scene panel (and the Game panel with Gizmos enabled), we see walkable areas forming a blue navigation mesh.
Note: The blue areas are the default NavMesh Area. See, later in this chapter, a recipe for different, custom named, costed, color-coded ...