Creating the NavMesh

To do this, implement the following:

  1. Open the Navigation windows (Window | AI | Navigation) and look at the NavMesh generation parameters.

In this case, NavMesh generation is quite easy: we are only interested in moving around on the ground surface plane, so there are no jumps, no links, and no slopes we need to care of.

  1. The only adjustment to the default NavMesh parameters we need to make is for the baking agent size (that is, the sizes of the virtual agent used by Unity to verify if a location is large enough to allow the agent to pass).
  1. In fact, the tanks used in the game are about 3 units large, so we need to instruct the generator to remove the areas that are too small for the tank to pass through:

In the ...

Get Unity Artificial Intelligence Programming - Fourth Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.