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.
First create a cube to depict the crate: Game Object > 3D Object > Cube.
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.
Add a NavMesh Obstacle component to the cube. Choose Add Component from the inspector and choose Navigation > NavMesh Obstacle.
Set the shape of the obstacle to box, changing the shape will automatically fit the center and size to the render meshThe main graphics primitive of Unity. Meshes make up a large part of your 3D worlds. Unity supports triangulated or Quadrangulated polygon meshes. Nurbs, Nurms, Subdiv surfaces must be converted to polygons. More info See in Glossary.
Add a Rigid body to the obstacle. Choose Add Component from the inspector and choose Physics > Rigid Body.
Finally turn on the Carve setting from the NavMeshA mesh that Unity generates to approximate the walkable areas and obstacles in your environment for path finding and AI-controlled navigation. More info See in Glossary Obstacle inspectorA Unity window that displays information about the currently selected GameObject, asset or project settings, alowing you to inspect and edit the values. More info See in Glossary 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.