- Home /
Use Fog of War to Restrict NavMesh Per-Agent
In a sim I'm working on, I have a grid representation of everything in WorldMap
, a class where every cell is populated with information about its space in the game world. Each NPC Agent (there can be up to 30) has their own MindMap : WorldMap
where all cells are initially blank but fill out as the Agent explores. Each Agent is attached to their own personal NavMeshSurface Components - Reason being, I want to constrain their NavMesh pathfinding to occur only in the area they've "discovered" so far, re-baking during runtime. Discovery happens both through movement and field of view.
If it was just one Agent, constraining the area would be as easy as toggling Areas explored/unexplored, walkable/not-walkable but these areas will differ for each Agent. I need help weighing potential solutions.
NavMeshSurface's Collect Objects -> Volume is almost what i need, but it's, annoyingly, restricted to a rectangle.
I could potentially clone the world plane's collider mesh for each Agent and use these as Not Walkable NavMeshModifiers, cutting away at them as the Agent moves during runtime (already giving me a headache)
Use the Agents' MindMap grids (blank values) to define a bunch of Not Walkable NavMeshVolumes, but i'll need to partition the grid into largest possible fitting rectangles so i'm not spawning in 5000+ 1-Square-Unit volumes, doing this often for each Agent.
I don't know if NavMesh Components give me any more options I'm not thinking of, any help at all before i dive in too deep would be appreciated.
I've got almost the exact same question, were you able to find a solution or did you go with something custom?