Need Clarification on the Importance of a Ground for Navigation Mesh

@Cedric

I have been playing around with the navigation mesh and it seems that the ground plays a more important role than identified in the docs.

Please note I have made some changes to computeNavMesh so that you can give a list of meshes and see it in wireframe

PG 1 ground, sphere and cube passed - everything good Babylon.js Playground

PG 2 no ground - no navigation mesh https://www.babylonjs-playground.com/#YQHA24#1

Hi guys, sorry to interrupt. John… are you missing some links in that last post, or… ? :slight_smile:

I went PG-searching for ‘computeNavMesh’, and decided to do a test with the YQHA24 series.

Notice that the ground can be setEnabled(false) and it still works. Cool.

Anyway, I increased the ground size to 16x16 at SOME point in my playing. The navver is definitely using the ground size as a factor… placing many of its points along the outer edges.

Just for fun, I thought I would randomize the edges of the ground a bit… see what fun it offered. https://www.babylonjs-playground.com/#YQHA24#3 Re-run often, for varying ground shapes.

1 Like

Indeed I did. Have edited them in. In fact I am getting so good at forgetting to put links in that I have been asked to try out for the Olympic Team GB missing links squad :slightly_smiling_face:

1 Like

Without the ground mesh, you can have navmesh on the top of the sphere and top of the box if you decrease the cell size. Otherwise, Recast can’t voxelize enough to ‘see’ those polygons.
see https://www.babylonjs-playground.com/#YQHA24#4
where I set cs and ch values to 0.05

1 Like

It seems that there is an awful lot I do not understand. I cannot get my head around how the list of meshes form the navmesh, which create the vertices and which remove the vertices for a start.

The navmesh creation internals looks like that (simplified)

  • gather all the faces from all the mesh set as parameters
  • eliminates faces whose slope is higher than the parameters
  • generate a voxel (depending on mesh size and cs/ch parameters this can take a lot of memory and cpu time)
  • get all positions from the voxel where a virtual agent can go (climb height, radius,…)
  • from all those positions, compute a mesh ( basically quads)
  • simplify the mesh and compute connections between the triangles
    So, the navmesh you’ll get will never fit exactly with the faces/positions you give. It’s an approximation. The good side is that you can provide multimillion face meshes and get a simplified version with quick access for path finding.
    The bad side is you need some learning curve to know how to tweak the navmesh creation parameters go get a good result for what you need.

Hope this helps :slight_smile:

3 Likes

@Cedric does this naveMesh work for my sation How to create a path root like google maps :frowning: :frowning: :frowning: :frowning: I’m waiting or ur merging.
I tried with a* algoritm but I find difficultes in the implemnetation in 3d.
does the solution of agents will draw a logical path between two point for example :
if I want to go from point A which is “technical local” in level 1 to “exit door” level 3, does it give me a logical path like a human behavior

I’m lost :frowning:

Hi @Anes
I did some test with your station and I was able to make agent move around with a displayed line for path. It needs more iteration between making meshes more compliant/more simple for the navmesh creation (stairs) and some tweaking but it works depending on your needs.

https://playground.babylonjs.com/#4T56MP

Trigger the navmesh creation by changing the walkableSlopeAngle to 46 then click anywhere on the debug navmesh to move agents and see the predicted navigation path.

Let me know if you need some explanation on a more specific part :slight_smile:

@Cedric thank u for ur effort,
the problem is that I need just to draw a “curving” paths (logical path) for example if I want to go from the level 1 to level 3, well the path should be on the left of the quai then the stair then the escalator … etc like reality path, not lines passing through train rails

@Anes
Then you can remove the train rails mesh from the navmesh creation list. It will make an hole that the agents won’t be able to pass over.

@Cedric and how about level if I add levels to navemesh does it work ?
here for example, if I select the point where the escalator there is no given path

You can have navmesh with multiple levels depending on the navmesh parameters (walkable height and walkable climb). You may have to tweak the source meshes or, at least do a first pas on limiting the meshes used to compute the navmesh. I didn’t get good results when I pushed all the meshes from your station. I would list only the meshes I need and tweak the mavmesh parameters until I get something good.

@Cedric I try to change walkable height and climb but there is no drawig path it orks only when I change walkableSlopeAngle to 46