Navmesh for a variety of agent sizes

I guess this is more of a best practice/technique question, but what do you do about a variety of enemy sizes on a single navmesh? I’m using Aron Granberg’s A* implementation, and it works fine for a single consistent agent, but for my project I need to have several agents of differing sizes on the same navmesh (think cartoony third person platformer).

Would you use multiple navmeshes? That doesn’t seem very efficient…

His editor interface lets you disable nodes, but it’s across the board. Disabling one node would disable it for all agents.

One thing I’ve seen mentioned is an obstacle avoidance system like unitysteer… but that seems like an entirely different rabbit hole to fall down.

Does anybody have any experience with this who can give me some advice?

Thanks in advance.

Are the pathfinding problems you’re trying to solve essentially 2-d? Or is full 3-d pathfinding required?

I’ve implemented a 2-d navmesh-based pathfinding system before that accommodated agents of arbitrary size, and it worked very well. The method uses a constrained Delaunay triangulation of the navigation space along with precomputed data that allows accurate paths to be computed for agents of arbitrary size. It’s not trivial, but it’s very effective. (Again though, the system I implemented was 2-d; support for fully 3-d environments would likely be more involved.)

Not sure if anyone is interested or not, but I’ve designed my solution out on paper and I think this is the direction I’m going to go with it:

  • I already have a waypoint navigation system in place for AI patrols
  • I already have navmesh A* integrated via Aron Granberg’s A* implementation

What I’m going to do is create an AI Helper trigger that, when the AI detects this ‘blockage’, it will start looking at waypoints that the level designer has positioned in a way so the AI knows how to navigate around the obstacle. Kind of a ‘mini A*’ model… very low-scale with no variable heuristic cost, just shortest path. At this point, the AI’s state changes and navigates around the obstacle- when it is clear of the obstruction and has line-of-sight on the player, it will revert back to navmesh pathfinding until it reaches another AI Helper volume.

I’m going to set it up so that these AI Helpers are tagged in a way that AI agents of varying sizes can use different AI Helpers. That way (for example), a rat AI could squeeze through a very small area, and a larger animal might have to go around.

I’ve prototyped out the first phase of this (obstacle avoidance), and it seems to work pretty well- so I’m going to move forward with the rest of my plan.

Here is an example:

  1. Generate unity NavMesh for radius 10 (for big agents)
  2. Store navmesh as regular mesh on level, name it Mesh1. It is stored in a raw format with the folder with current scene. Or you may use any navmesh generator.
  3. Assign Mesh1 NavMeshLayer to a layer “BigOnes”
  4. Generate unity NavMesh for radius 1 (for small agents)
  5. Delete Mesh1 (or it could be done before release)
  6. Assign small agents NavMesh layers mask to go with layer “Default” (or whatever layer name you use for small ones)
  7. Assign big agents NavMesh layers mask to go with “BigOnes”

Hi,

I have found a workaround solution that works quite OK in my case. I’ve posted the answer in this forum thread:

http://forum.unity3d.com/threads/178628-Problem-with-Unity-NavMesh-and-multiple-agent-sizes-(with-a-workaround-solution)?p=1221631#post1221631

Cheers,

miecz