How to create graphs for a watery area?


I’m working on a game that has levels with both water and land. In these levels, some characters can only swim in the water, and other characters can only walk on the land. To support this, I figured I could use two graphs: one for the water, and one for the land. I tried to scan these as two Recast graphs, having the water graph scan based on the “Water” collision layer and the land graph scan based on the “Default” collision layer, as shown in this screenshot (with real game assets replaced with placeholders):

As you can see, there is an issue with these graphs. Because the water is implemented as a quad stretching across the scene, the water graph takes up the entirey of the quad, which would allow swimming characters to swim right through the land, which is undesirable. I considered solving this issue by assigning a RecastMeshObj component to the land colliders with an area type of “Unwalkable surface”, but I don’t think that would work because it would have the undesirable side effect of making the land graph also consider the land to be unwalkable.

If RecastMeshObj supported constraining its effects to a certain graph, then that would provide a solution here, but I don’t see a way to do that currently. Is this a feature you would consider adding, or is there another way you would recommend that I do this instead? Thank you!

After thinking about this more, I realized that this problem could be solved using tags and the GraphUpdateScene component. Thank you for creating such a flexible system and I apologize for not thinking this through more before posting.

1 Like