I need a custom height check (basically, 5 rays instead of one, with averaging of hit heights; this is because the underlying collider is not aligned with the grid, so a cell can be e.g. divided diagonally, with a deep drop on one side, but still have “ground” in center, so the usually height check will mark it as walkable, which will look badly at runtime).
I can run a PostScan step that will do additional raycasts, and set/clear Walkability flag + add/cut connections depending on results, but this feels somewhat wrong.
Thank you, it worked. GridGraph rules are an interesting addition for sure. I think I need another rule, but I’m not sure which Pass it can use: after all areas are calculated, I need to make nodes belonging to some of them unwalkable (basically, I want to eliminate accidental “islands” that are never really reachable; I have some additional information that allows me to do that).
In 4.x, this was done as an additional code after scanning the graph.
In 5.x, it seems that this can be done in Rule in PostProcess pass, but the manual explicitly states that I should not modify walkability there “because connections will not be up to date”. But since I’ll be removing whole areas, so I don’t care about connections. Still, it bother me. Or maybe I shouldn’t use Rule for that? I can simply add a GraphModifier (I need one, anyway, for other reasons) and do this in LatePostScan?
It seems that the linked thread tries to solve a different problem, and I’m not really seeing how it is related to mine. It mostly deals with the question of removing nodes already marked as unwalkable from a Recast graph, which is not what I’m trying to do. I can’t remove nodes (since I’m using a GridGraph), but I need to mark them as unwalkable, despite the fact that they passed all previous checks.
To do that, I’m using a kind of “probe” components that are added to all possible entrance and teleport points on location: I check which Area ID are located under my probes, and remove nodes whose Area ID don’t fit this criteria. This works pretty well. I just need to find a good point in the pipeline where I can actually do that. As I said already, GraphModifer’s LatePostScan seems to fit the bill, but maybe Rule’s PostProcess pass does, too, if I can actually somehow modify walkability during that pass.
If you are trying to use the Area property of each node, it won’t be available when the rules are calculated, I’m afraid. This property is only calculated after all graphs have been scanned.
You could do a flood fill yourself and calculate the connected regions, I suppose.
In that case I would recommend doing it in the PostProcess pass, but also recalculating connections after you are done using the same code that the grid graph uses to calculate connections: