I’m using the local navmesh builder, one spawned for each agent, at that agent’s position, and tracking that agent. In order to ensure the agent gets assigned a navmesh, I delay agent activation until after the localNavmeshBuilder is spawned and active.
I found that when I spawned multiple agents in the same area, one of the agents would be ‘bound’ or assigned to the others navmesh. It seems to always be the 2nd spawned enemy that is tied to the 1st spawned local navmesh.
At first I thought this was because their spawns sometimes overlapped, so when the agents assigned themselves to the nearest navmesh, the same one was chosen. To work around this, I start each localNavMeshBuilder’s size to be very small so they would never overlap. After a few seconds’ delay, the size is increased to normal size.
However, even with that workaround, it seems that, after agent B walks into agent A’s navmesh instance, and tries to walk out, it still gets stuck on the edge of NavMesh A. Despite its own navmesh, the one it started on and was presumably assigned to, expanding beyond that point (since it’s centered/tracked on agent B.)
Here’s an illustration, mind the crappy drawing skill:
I guess what I’m after is a way to assign a navMeshAgent to a specific navMeshDataInstance? However I can’t find a way to do this through the docs. I can’t use one large LocalNavMeshBuilder navmesh because of the game’s scene size + distance between spawned enemies.
Thanks for any help.
EDIT:
(See below comment)
After moving the target around a bit more it was able to move past the edge. Still a strange issue however. It definitely gets stuck at the other navmesh’s edge. Maybe until it auto repaths?