What is the most efficient way to have obstacle on a navmesh, that are created at runtime?

At the moment I am using a base mesh that I use to create a nav mesh.
Basically the only aras marked as static for the navmesh, are the floor and walls.

I did notice though, that when I place new objects, the agents get stuck. They hit the collider of the object placed at runtime, but they continue to walk, like if they would try to go through it.

I did add nav mesh obstacles for each object that is instantiated at runtime, and selecting “carve”. Is this the correct way to add obstacles at runtime?

Carve will actually modify the mesh. It’s useful for objects that don’t move much, or that the agent should clearly go around.

Turning carve off makes the agents simply use avoidance behaviour, rather the repays around the obstacle. It’s more sensible for transient obstacles.

1 Like

I see, so the carving is actually modifying the nav mesh.

Would this be less expensive, compared to rely on the avoidance behavior from the agent? From what I can tell; the Agents get stuck trying to go around an object, even if it has a collider; which make me think that the agent can’t even see the object as something that should be avoided.