More intelligent pathfinding by setting different costs for custom-defined navigation areas such as Mud and Water

We can create objects whose meshes are defined as more expensive for NavMeshAgents to travel across, helping AI-agent behavior be more realistic in terms of choosing faster paths that avoid Water, Mud, and so on.

To create a custom NavMesh Area (we'll pretend it's mud) with a higher travelling cost, do the following:

  1. In the Navigation panel, reveal the areas by clicking the Areas button. Then, define a new area named Mud with a cost of 2:

  1. Create a new 3D Cylinder named Cylinder-mud, positioned at (0, -4.9, 0) and scaled to ( ...

Get Unity 2018 Cookbook - Third Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.