Recast, can crowd agents be split into ad-hoc groups

I have been starting to experiment with the Recast-Detour navmesh system as an alternative to a much more old-school method of routing using a pixel grid and A*.

By default, when you create a crowd, all agents move together as one, toward a target. Is there any way to split a created crowd into multiple groups and each moves to a different target? They sometimes will split up anyway if an obstacle blocks some from following the others, so I guess a sub question is there a way to force / control that behavior.

On the same lines, is there a way / example of dynamically adding members to crowds or remove them on the fly?

cc @Cedric

Hi @Calsa
Group management is left to user. You can have a group object that contains an array of agents for example. Then, if you want to have some swarm behavior, you can elect one agant as the chief and make other agents from to group to follow that particular agent.

Crowd should be allocated for the maximum agents needed. This is for performance reason. Then, it’s a matter of not using/not displaying an agent.

1 Like