I have a reached a point now where I can select X amount of units, and move them to where I click. My problem is, they all try to get to the same point.
I use Unity’s own Navmesh + agent.
I set destination like so:
public bool MoveToPoint(Vector3 point)
{
if (SamplePosition(point))
{
agent.SetDestination(point);
return true;
}
return false;
}
I tried a system where I send an event when ANY agent reaches the point, then all agents stop, but realised quickly that will never work well.
I’ve read the material I can find through Google but nothing really helps me get started.
If I have a List of units, all with an attached agent, how can I move these to a point while keeping some sort of logical formation, no matter how far apart they started?
It does not have to be very fancy, I just want them to stop bumping into each other and doing that weird “Spassing out” thing they do when they can’t reach their destination cus they are in each others way.