RecastJS - Multiple Surfaces

Hi All,
I have been working on navigation for the new all Typescript version of BabylonBurst and I waned to add an option for multiple surface types with navigation.
I remember from the original CPP version of the library that it is possible to make multiple navmeshes and I was wondering if there is a way to do this (eg a water layer, a ground layer and even an elevated air layer).
Would the best/only way to do this to be use multiple new BABYLON.RecastJSPlugin() instances for the different layers?

cc @Cedric

Hi @JHines

Having different plugins will result in crowd wandering in one or the other. I mean it won’t be possible to share datas between both plugins.
I don’t remember seeing different navmesh in recast. I believe you can have different ‘zone’ and have portals or teleport to get from 1 to the other.
Can you elaborate on your use case?


Firstly, I appreciate your swift response!

I’m currently working on an RTS, and one core feature I’m envisioning is the delineation of different terrain types, specifically ‘land’ and ‘sea’. This would then facilitate the design of vehicles that can operate exclusively on either land or sea, or those that are amphibious, capable of functioning in both environments.

To provide more context, I’d direct you to my BuildSystem and NavigationLayer as an illustrative example. The concept here is for the system to build a specific layer, after which agents are then designated to that particular layer (or potentially multiple layers in the case of amphibious).

In the previous CPP version of BablyonBurst I was going to use areas for this effect - see OldBuildSystem line 135.

This isn’t an immediate concern, as I am still working on BabylonBurst and won’t get to the game for a little while. However, I believe it’s crucial to lay the foundations correctly for the ECS navigation system. I’d appreciate any insights or recommendations you might have.

Thank you for your time :slight_smile:

There is something related in recast called area type :
geometry must be tagged. I’ve never used that but as far as I understand it, triangles provided to recast for computing navmesh must be tagged.
It seems to be demonstrated in recast sample. You can try to build and test it and let me know if it’s something that can help you.