Hi, I can’t figure out one issue with the Recast graph. There are a lot of tools to cut out a piece of the Recast graph navmesh inside specified objects or to add navmesh, but I haven’t found anything that removes navmesh on the outside selected objects, that is, using objects as a mask to define where the navmesh should or shouldn’t appear. The thing is, I need to make async rescan the recast graph at runtime every time I update masks (for example once in a minute), and the level’s structure makes it easier for me to mark where the player can walk rather than where they cannot.
I was considering a couple of solutions, like a black-and-white RenderTexture that triggers an Async Scan when updated, or a set of mesh masks that cut off everything outside them during baking. I looked for such methods, but unfortunately didn’t find anything. So I’d like to know, may be I missed something, could you please suggest a way to implement something like this? I know grid graph supports texture masks, but I specifically need Recast.
I’m realizing I neglected to post my thought process for why I suggested that! But actually I want to confirm my thoughts before I suggest it just to go from 95% sure to 100% Gonna test it out now.
Nope! I was almost correct– I couldn’t scan “something from nothing” like I thought, even with RecastNavmeshModifier. Been down a bit of a rabbit hole looking for options, but I think you could just use a RecastNavmeshModifier and tags, maybe? And then mark everything else as not walkable, if you really need it, which is as simple as this:
var graph = AstarPath.active.data.recastGraph;
graph.GetNodes(node => {
node.Walkable = true;
if (node.Tag == 0) { // Default tag becomes unwalkable
node.Walkable = false;
}
});