Hi,
I want to be able to test if an area of the navmesh is valid so that I can spawn an AI character, at the very least it would be nice to test if a sphere volume could be tested against the mesh and would return true if all the area that intersects with the NavMesh is walkable. My example involves finding a fairly large area (> 2m) to spawn an elephant. This information cannot really be baked into the navmesh as the point we test as the centre of the volume could be on the edge of the mesh which would make it invalid.
I can see that you can use GraphCollision but it would seem that this is for generating the walkability information for a GridGraph and not runtime checks. We would prefer to be using recast graphs in the long run as the world is fairly large and they will scale better.
Navmeshes generally assume that everything on the navmesh is valid space.
I.e the radius of the character is baked in to the navmesh. That is one reason they are so efficient.
When you have multiple units of different radiuses, I recommend that you create one or two more graphs with a different baked radius. Then the agents can navigate on the graph which has a baked radius closest to their own.
Basically what you want to do is to find out if your 2m sphere intersects any edges.
That can be done with the current system. But it requires some processing and non-trivial code. First try if the above works for you, then you can consider this.
Hi Aron,
I agree that in principle it would be great if I could bake the information into the Navmesh however for the project I am currently working on I need to support >8 different animals of radii varying from 5cm to >1m. I was hoping to try to generate a few (2 or 3) meshes with different baked in width on which I could then use some tricks to fit various sub groups of animals to each mesh, hope that makes sense. Usually in the past I would have approached this problem with a string pulling/pushing smoothing algorithm that ensured a min distance to the the nearest edge (where possible). I would have had a go at writing my own modifier to do this however I have a limited amount of time to get things up and running.
This isn’t so much of an issue for me now as eventually I realized I was overly complicating things and just rewrote it to use explicitly placed spawn points, of which not enough are needed to make it prohibitive to place them manually.
I think this would still be a useful feature to make more accessible in the future as with your upcoming cutting feature for dynamic obstacles even placed spawn points could become invalid and it would be nice to be able to test them at the time they are used.