Alternative Navigation Mesh Solution

Hello guys,

So I have used this navigation mesh plugin for what feels like forever now. GitHub - wanadev/babylon-navigation-mesh: A library to move on navigation mesh with BABYLON.js . It is quite stable and accurate for my needs at least.

I have also been able to work on it for one of my projects ( Which I will share in the following days ) and optimize it. For instance, the plugin, for reasonably big navmeshes, loads in less than a couple of seconds. For most use-cases it will load under 1 second. ( Not the version in the repository, my modified version ) . Now I know Recast has been included but I do not see having an alternative as a bad thing. The advantage in using this version stands in the fact that the code is entirely in Javascript and it is modifiable / adaptable/ optimizable. It is not a port of some c++ library.

Do you guys think it would make sense to incorporate it as part of the engine or make an official linking and offer it as an alternative? We do have multiple alternatives to physics engines, why not have the same for Navigation Mesh libraries?

EDIT - This issue NavMesh error on big mesh was an inspiration to why I posed this question.

Pinging @Cedric

Hi @Null

The UI and parameters in Blender look a lot like Recast. There are 2 parts:

  • generate/load navmesh from blender
  • use wanadev lib for crowd and agents navigation

I think you are mainly interested with the first part. That part might be possible relatively quickly. Basically, it’s figuring out how to save/load navmesh. It’s definitely an interesting feature I should add to the navigation!
The second part will need more work and apart the ability to change the code more easily, I don’t see much benefit from doing it.

Hey @Cedric,

Thank you so much for answering my question so quickly. I was more wondering whether both solutions could co-exist as alternatives to BJS.

Blenders functionality is a port of Recast. It should be the same generation code so probably is compatible ( hopefully ).

This would solve the issue of computing large navmeshes. If they are already computed and you simply feed them into the Recast plugin it should save some time. However, look out for the loading performance if you are going to implement the load functionality. Reading the navmesh can become quite an expensive process.

If loading the navmesh will be supported there is no need to implement anything else from wanadev. It would make sense to support a JS based Navigation Mesh per se but not change Recast to the wanadev.

Awesome! That’s the way to go!
Do you know if the recast support in Blender effectively supported? Is it a 3rd party plugin or is it supported by the developers? Is it still present in Blender 2.8?

Hey, glad to be of help.

The game engine of blender was entirely removed in 2.8. I think also the navigation mesh :confused: . It was not a third party but a part of blenders dev.

that’s annoying :confused:
Do you have a scene that works with Blender navmesh creation and that doesn’t work with Babylon? Using the same parameter values.

Hey Cedric, sorry for being so late. Somehow I missed your comment. Yes, usually with big scenes BJS fails to create the navmesh. I can send a scene over if you want later.

I have modified the GitHub - wanadev/babylon-navigation-mesh: A library to move on navigation mesh with BABYLON.js library and made it very performant. In a simple test I did, loading the navmesh with this library vs generating it with the recast plugin had a difference of 3 seconds +. Also, I did not test the same navmesh complexity as BJS fails to generate big ones, so the imported meshes were more complex.

I had to optimize it since, on safari for instance, any script taking more than 5 seconds is killed. Have you tried generating a navmesh and opening from an iphone? Maybe it gives you issues.

@Deltakosh I would be happy to maybe write a plugin for my modified navmesh javascript solution. Would this be something interesting? Right now it only supports imported navmeshes but I don’t think it will be hard to port the recast navmesh generation to JS.

Cheers!

Hi @Null

I can try 2 things:

  • save/load computed navmesh from recast
  • use any mesh as input navmesh

The second will be more difficult but it will allow amazing things like having navigation on a sphere for example.
Please, send me your scene, I’ll do tests with it.