Debugging navmesh

Hi :slight_smile:

Silly me was down to me not updating the agents that update the navmesh

Is anyone else experiencing this issue?

Cheers

Hi @GetReqked ! Welcome aboard!
It seems that it breaks around 60 obstacles. I’ve checked the BabylonJS source code and there is no limit on the number of obstacles. Adding an obstacle just calls RecastJS’s addObstacle.

EDIT: Do you really need so many obstacles?

EDIT: A web search on the given issue yielded to zero results. Ppl are talking about certain limitations on the navmesh complexity but I didn’t find anything about the maximum number of obstacles. Maybe it’s worth to have a look at the RecastDetour C++ code.

@Cedric might have an idea about this one ?

Obstacle count is limited to 128 Extensions/recastjs.cpp at 15015b541accb96e33a78362ca907dc914258890 · BabylonJS/Extensions · GitHub

2 Likes

I have a question related to this:

Currently I’m managing my door system with obstacles. However just a few days ago I noticed that the systems seems to break since I’ve been using obstacles also for some dynamic objects. So… I may go way over the 128 limit.

I have few solution ideas for this:
a) I could just do a regular nav mesh calculation, but I need to form it after all the semi static objects are in play…
b) Could recalculate the nav mesh after an object is added and with that object and all the other stuff. Is it expensive to actually recalculate the navmesh more often?
c) Is 128 really the hard limit for ever and ever?

There is no ‘perfect’ limit. It’s a trade off between having enough and limit the memory used by the plugin. If someday I change it to 256, someone would come asking for a 512 limit :wink:
You can recompute the navmesh in a worker thread to some extend. If you want to do so with thousands and thousands of triangles, it will be an issue. Also, 128 dynamic obstacles is quite a lot. Do not forget that’s it’s dynamic around the player. so, for an open world for example, you should disable portions of the level that are too distant from the player and only have dynamic obstacles for the close envirronment.

1 Like

Yeah, but my use case is that I run navigation in NullEngine in the server… That means that if I, for example, lock all doors, I need to add obstacles to all doors since there is a possibility that there is a player near every door :smiley: So the hard limit for doors is 128 per level. Not a problem still since not that many doors in the single level :laughing:

1 Like