Navigation Mesh and crowd Agents

A new extension has just landed in Babylon.js: Navmesh and agents navigation.
You can now populate your scene with autonomous agents with path finding and avoidance.

The documentation is accessible here Babylon.js Documentation under the tag ‘navigation’
The feature is still in beta so feel free to test and post your requests and issues in the forum.

Happy navigation!

Cedric

17 Likes

Huge!!! this is a suepr cool addition to our game framework

Hey,

Amazing addition. There was already a navigation mesh plugin for babylon here GitHub - wanadev/babylon-navigation-mesh: A library to move on navigation mesh with BABYLON.js but this looks much more polished. Question, does it support static navmeshes as well? Will it in the future?

1 Like

Nice project.
I’m trying to make it work. I downloaded the demo to try it on my pc but i get this error:
ReferenceError: Recast is not defined
But the demo works on babylonjs playground. I’m using the exactly same demo code.

Include recast if you haven’t already
https://preview.babylonjs.com/recast.js

That fixed the error.
Now i get Could not build Detour navmesh in console when i try it with my ground from heightmap.

I sent you a PM with details.

Pinging @Cedric to help

Hi Manrix,

Basically, the parameters you provided are not valid with your mesh so a navmesh can be computed. The error message is not explicit and will be improve in the future.
For height maps, maybe try to tweak the climb height. If it’s too steep with a small climb height value then no walkable area will be found.

Do you have a PG so I can help you debug the parameters?

Hi.
Yes, changing the parameters it doesn’t return that error. But i don’t think the mesh is generated.
I sent you more details in a PM.
Thanks.

Hohoho, I never manage to get that part works great on https://wazana.io! I will definitely take a look at this and give you my feedback @Cedric :wink:

Pretty good. How did you manage to get the filesize to be decently enough within 755KB?

Is there any way to save the dtNavMesh so it can be reloaded again? What about Dynamic obstacles? Also, tileSize seems to do nothing? Is it possible to create tiled navmeshes?

Also, is it possible to have a build with only Detour but no Recast?

Hi @Glidias

All those features are available with recast but we only expose a small portions. Depending on the need and use cases of Babylon.js users we will add the corresponding api calls and documentation.

Do you have a use case you would like to discuss?

At a basic level though, it’s needs the requestAgentVelocity function to directly input velocity into agent instead of set target location. That one shouldn’t add anything to the file size.

Hi! Great plugin! I start with implementation it in my game.

Are you planning to do some modifications i goTo action? I think about instant start and stop without acceleration?

Hi @FurcaTomasz

You can tweak the acceleration to a high value so the agent will reach maximum speed in one frame.

Hi, Cedric. Can we use recastjs as es6 module?

1 Like

hi @kvasss

I have absolutely no idea.

I’m sure @sebavan knows :slight_smile: And if it can’t be an ES6 module I’m pretty sure we can do some changes to make it compatible.

1 Like

Hi, @sebavan. Can we use recastjs as es6 module?

Thanks/ pinging sebvan

the current version looks more like a UMD module (es5) but I guess there might be some wasm options to create an es6 version: es6 module support flag · Issue #6284 · emscripten-core/emscripten · GitHub

So that we could provide 2 files, a umd and a es6 module. Now this would not be tree shakable or code splittable anyway.