GraphUpdateScene - object share recast mesh triangles

I want to have diffrent costs walking on different fragments of navmesh but GraphUpdateScene doesn’t split navmesh into different triangles. Is there possibility to do what I want? Here you have screens to ilustrate problem:
My configuration:
1000/0 - penalties
Unwalkable - modify walkability set as true, value as false
Blue arrow - what I want to achieve - agent is going using region with lowest penalty.
https://i.gyazo.com/7365f60004ad30ff73c54edc8267b3db.png
Problem:
https://i.gyazo.com/a592c7a050ec6aa94874ac41c96d1f4b.png

Hi

This can be done, see https://arongranberg.com/astar/docs/recastmeshobj.html#area

However when using penalties I recommend using grid graphs since you will get more predictable paths with that. On grid graphs it can take penalties into account more accurately.

1 Like

I have quite big scene with multiple “levels” (I mean for example building with several floors), dunno if grid graph won’t have bad performance on it. For now I will try solution that you have posted. Thanks!

This can be solved by using a layered grid graph.
If this works with good performance or not depends on how large you need your graph to be.

Ok, RecastMeshObject combined with GraphUpdateScene fixed problem for mesh + mesh combination, but now when I’m trying to do this on terrain + RecastMeshObject it doesn’t work (green cube is shown in inspector).
https://gyazo.com/76805646c0063fe4dfe508f57ce2e14f

Edit while writting, I leave this comment for someone with same problem:
RecastMeshObject area and GraphUpdateScene tag value has to be the same - aron_granberg maybe it could be rename from “area” to “tag”?

Hmm, I don’t think that’s the case. The RecastMeshObj area does however need to be different than the default one (Walkable Surface = 0). The terrain will already have the “Walkable Surface” area and a seam in the navmesh will only be generated where the area id changes.

I have one more problem here. When I do it on test scene (created by me) it all works ok, but when I do it on my “real” scene it gets a little wild. When I cache graph in editor, nonwalkable areas are red, but when I press play all areas are blue again and are ignored by RichAI (agents walks normally on them). To be clear - cache is properly loaded on test scene (nonwalkable areas are red in playmode) and semi-properly loaded on “real” scene (geometry is good, RecastMeshObject with “unwalkable” GraphUpdateScene is visible as a separate part of navmesh but it’s blue in playmode, not red). And now, is there anything that comes you to mind that can be reason of this strange behaviour?

Hi

Are you using navmesh cutting in the real scene?

Yes, I do. (to be clear - I use it to diffrent cases than GraphUpdateScene but I assume that you want to know if I use it in general).

Edit:
Here is my post from another thread about same thing:
In general I’m using navmesh cut but not in this case. I have RecastMeshObject and in child I have GraphUpdateScene. It looks like this when not in playmode:
https://gyazo.com/ded60b07297cc694e1feabdefe03814a
But when I enter playmode its like this:
https://gyazo.com/119b2e082c7a495482968ef5acb181a6
I’ve tried to “Generate cache” and “Save to file” with scaning before and with scaning while saving, no succes, I have “Cahce startup” enabled and “Scan on Awake” disabled.

Okay.
So the tricky thing with navmesh cuts is that is is often impossible to preserve the walkability, tags, and other properties of the nodes because the nodes themselves may me merged, split or change shape when the navmesh cut is applied. So if possible I would suggest that you call the .Apply() function on each GraphUpdateScene component after the graph has been loaded. This might solve the issue.
This is assuming none of the navmesh cuts move during runtime.