Nav Mesh Obstacle/Agents not working well

Hi

Now that we can place the Spawners we can see the Nav Mesh Obstacles and the Nav Mesh Agent interact. Unfortunately it still seems to collide. I’ve doubled the Obstacle size and here is a scene view:

navmesh obstacle

It’s clearly clipping. I can build little mazes and it does work but the Carve, or something else, just doesn’t seem large enough and bodging the colliders to be bigger isn’t elegant.

In the tutorial at 10:00 you can see the three spawned tanks overlap quite a lot with the UnitSpawners.

I’ve also noticed the Units, Nav Mesh Agents, are not very smart going around each other. Sometimes they bulldoze through each other or get very close and slow down on the periphery before speeding up to their destination.

Is this intended behaviour? It may behave better on a larger scale like the RTS, but on a smaller scale, like imagine a house interior, this seems to not work well.

Hi there,
Have you try updating the navAgent radius in the unit prefabs? Or the default radius in the navMesh settings?
At some point in the course we also set the spawning units to move to a random location to avoid them stacking in the same spot when they spawn.

Thanks for getting back to me. Increasing the Agent Radius on the Navigation Bake tab seems to be the only way.

After playing around a bit I’ve come to these conclusions:
Most of the radius settings are only for Agent vs Agent collision.
Everything uses the same NavMesh.
I can’t figure out how to use multiple agents, it just doesn’t like it.

This means you cannot have a large tank and a little marine be the same edge distance from a NavMeshObstacle. The agent will always move the pivot point to the edge of the NavMesh.

A way to get around this is to use the NavMeshSurface from github (Unity-Technologies NavMeshComponents). A NavMeshSurface component is added to a gameobject and this works similar to the Navigation. Here’s a screenshot:

Two NavMeshSurfaces have been added. You can see the floor has two NavMeshes; one for the big cylinder (Ogre) and one for the smaller one (Humanoid) (sorry I should have colour coded them). Their pivot points are restrained by their respective NavMeshes so that the edges are the same distance from that middle cylinder. It’s pretty cool as that smaller cylinder can fit between the two obstacles and the bigger one has to go around.

Anyways, this course is about Networking so I’ll probably just stick with what we’ve got and save this for something else.

I’ll mark this as a solution but I would have liked to see how this is done with the in built NavMesh.

1 Like

This topic was automatically closed 24 hours after the last reply. New replies are no longer allowed.

Hi there,
Have you played around with the navMeshAgent settings on the prefabs of the individual units? This might help you out a little.

Privacy & Terms