- Home /
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.
Answer by testure · Jun 13, 2011 at 08:46 PM
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.
Answer by Jesse Anders · Jun 10, 2011 at 01:30 AM
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.)
yeah, it's a 3D environment. I'll do some looking into Delaunay triangulation though, it sounds interesting.
Answer by KPEKEP · Jan 05, 2012 at 07:47 PM
Here is an example:
Generate unity NavMesh for radius 10 (for big agents)
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.
Assign Mesh1 NavMeshLayer to a layer "BigOnes"
Generate unity NavMesh for radius 1 (for small agents)
Delete Mesh1 (or it could be done before release)
Assign small agents NavMesh layers mask to go with layer "Default" (or whatever layer name you use for small ones)
Assign big agents NavMesh layers mask to go with "BigOnes"
Hi $$anonymous$$PE$$anonymous$$ep,
Thanks for you advice but I don't quite understand step 3.
I have made a nave mesh and then renamed that mesh1 in the project view. How do I then assign $$anonymous$$esh1 to BIgOnes layer?
Thanks
I have been trying to do this fix with no luck. I generated a Nav$$anonymous$$esh with a 1.0 radius and baked on the "bigOnes" layer to navmesh.asset in the level's folder. Then I rename it to "$$anonymous$$esh1" as the raw format. How do I assign this back to the layer? This doesn't make any sense. Please help, I really like this idea and would like to implement this fix, thanks!
I'm in the same boat. How are you using the Nav$$anonymous$$esh raw file as a mesh?
Answer by m-i-e-c-z · Apr 16, 2013 at 08:27 PM
Hi,
I have found a workaround solution that works quite OK in my case. I've posted the answer in this forum thread:
Cheers,
miecz
Your answer
Follow this Question
Related Questions
Dynamic Levels & Navmesh 7 Answers
NavMeshAgent Different Sizes Help 0 Answers
NavMesh.CalculatePath is acting weird 2 Answers
How to set NavMeshAgent Path with Vector3[] ? 2 Answers
Implementation of Navmesh terrain dijkstra algorithm 0 Answers