Multi-mesh navmesh

As I understand it, I need @Cedric :smiley:
In fact, I have a lot of questions for the guru of Babylon, but at the moment I have been struggling with navMesh for 2 weeks.
I am trying to develop an online strategy, I need the units to find their way from point β€œA” to point β€œB”, bypassing buildings (loaded meshes) on the heightmap (this is important) and obstacles.
Now the problem is that the meshes at the end of the path behave stupidly, they stagger in place, everyone tries to get to the point that was indicated for movement, that is, they do not calm down and do not think that the job is done.
This can be viewed in the sandbox (I took the standard one and made a few changes).
Also in the second sandbox with a height map, I noticed that with several groups of agents - meshes are not perceived as a fixed obstacle, the first group pushes them brazenly when trying to pass. I played with the parameters of the agents, got to the point that with certain settings they try to bypass the second group, but not always correctly, 1-2 meshes from the crowd cannot bypass the second group, because get too close due to other agents and no longer know how to get around

I’ll take a look first hour on monday :slight_smile:

and with some settings an error appears with the height map - is this because of what?
recast.js:30 Uncaught Error: abort(OOM). Build with -s ASSERTIONS=1 for more info.
a lot of difficulties with the height map and navMesh, but you cannot allow units to move in a straight line, I would like to debug and be happy, do other things

Hey Lazarus,

I think the reason your first one is because they are β€œfighting” for the same spot - you need to come one with a algorithm that separates points in to your desired shape e.g. example below is a simple straight line

I’ve found that using the following attributes will stop a crowd from moving -

But if you want one crowd to go around another you will need to add in a obstacle to the navmesh when the crowd has reached its desired location.

Good luck in your game! :slight_smile:

1 Like
I sort of figured out what you mean and corrected the code. I added an offset array to move the rest of the group to, but you have to set a compulsory - I’m not sure if this approach is correct. But in this way I can further build the marching order (star, wedge, line, etc.). See if this is correct or is there a better way?

For the error: Uncaught Error: abort(OOM), the resolution for building the navmesh is too high. Memory is limited to not explode performance. Try other cs and ch values, expecially if the world bounding box is too big. Also, you can use bounding box instead of full mesh definition (like a box instead of a building used for rendering)

If agents are given the same destination point, they will fight for it. They will push other agents. Many solutions are available:

  • give each agent a different target (like in a formation)
  • Allow a radius around the destination that will be enough.

For the former, you can use an observer : Crowd Agents | Babylon.js Documentation

For other technics, it all depends on your use case. For example, can 2 group of agents mesh together? If they fight each others, then maybe, there is no need to take care of avoidance. If you move 2 group to the same spot, then you can detect that and compute formation points for each agent as if it was only 1 group.

Also, for formation spot, be sure to have enough space between them so agents can navigate between.

1 Like