Legacy Documentation: Version 5.4
Creating a NavMesh Agent
Creating an Off-mesh Link

Creating a NavMesh Obstacle

NavMesh Obstacle components can be used to describe obstacles the agents should avoid while navigating. For example the agents should avoid physics controlled objects, such as crates and barrels while moving.

We’re going to add a crate to block the pathway at the top of the level.

  1. First create a cube to depict the crate: Game Object > 3D Object > Cube.
  2. Move the cube to the platform at the top, the default size of the cube is good for a crate so leave it as it is.
  3. Add a NavMesh Obstacle component to the cube. Choose Add Component from the inspector and choose Navigation > NavMesh Obstacle.
  4. Set the shape of the obstacle to box, changing the shape will automatically fit the center and size to the render mesh.
  5. Add a Rigid body to the obstacle. Choose Add Component from the inspector and choose Physics > Rigid Body.
  6. Finally turn on the Carve setting from the NavMesh Obstacle inspector so that the agent knows to find a path around the obstacle.

Now we have a working crate that is physics controlled, and which the AI knows how to avoid while navigating.

Further Reading

Creating a NavMesh Agent
Creating an Off-mesh Link