MinRegionSize strange behaviour on my RecastGraph

Hi

I am trying to get RecastGraph right on my terrain. It works in overall, but we are using some boundries to manually defy boundries of walkable terrain. It scans rather right, however, it leaves plenty of small regions, that are cut off, but still scan as graph. My guess is the best choice here is to incarease min region size to a value where the main surface remains ok, but all those small unused regions would not include. And here comes my problem. No matter how big I set the value of Min Region Size, nothing changes!. Even if I set it to 99999999999999999999999999999999999999999999999, the small size regions you can see still remain:
image

I guess for some reason MinRegionSize isnt working here, at all. Do you maybe have some idea why it might be? Here are my graph settings:

Any thoughts would be appriciated, as for now we do a massibe workaround for this in code, but it’s completly messy, heavy and unstable, if we could only get the graph right it would save our game sooo much trouble :). Great asset by the way :wink:

Hi

The min region size cannot remove any regions that touch tile borders because tiles are calculated completely independently, and how large a region is can be changed after a graph update.

You could filter the nodes afterwards if you specifically need to remove these other regions though, I can post that code if you want.

Hi Aron

Oh, I see.

Yes, that code sounds interesting, as for now we decided that level designer will manually cut those remainding unused parts by placing colliders, but it’s quite much of work for our terrain which would keep on growing yet :D. So, if you have a code that can filter it automatically, I’d appriciate very much if you could post it.

Hi

Here’s something I think should work:

AstarPath.active.AddWorkItem(() => {
    var graph = AstarPath.active.data.recastGraph;
    var keepArea = AstarPath.active.GetNearest(knownPositionYouWantToKeep).node.Area;
    graph.GetNodes(node => {
        if (node.Area != keepArea) node.Walkable = false;
    });
});

Note that this will only make all of those nodes unwalkable, not actually remove them from the graph.