Arrive as group

Hello,

I can’t seem to get the rts units to arrive as a group, like in SC2.

If I had selected 3 in a line and click to move, they funnel. I would like them to arrive in that same line.

However, if there are a certain high number of units or one selected unit that is far away from the group - the group would then funnel, to bring in the outlier unit.

Do you have some code, pseudo or not I can use to try and get this functionality?

Using the pro version

Hi

Sorry for the late answer.
There is no example of this in any example scene, however there is an API for it.
You can use the PathUtilities.GetPointsAroundPointWorld method.

Something like this (pseudocode)

// If you are using a grid graph, you can change this to some other graph otherwise
var graph = AstarPath.active.gridGraph;
List<Vector3> currentAgentPositions = ...;
for (i in agentCount) {
   currentAgentPositions[i] = agents[i].position;
}
// The final points will be at most this distance from the groupDestination.
float maxDistance = 10.0f;
// Should be around the same size as the agent radii, possibly slightly smaller
float clearanceRadius = 1.0f;
// This call will modify the currentAgentPositions list
PathUtilities.GetPointsAroundPointWorld(groupDestination, graph, currentAgentPositions, maxDistance, clearanceRadius);

for (i in agentCount) {
   agents[i].destination = currentAgentPositions[i];
}

Hey, thanks for the reply. I will get this going now.

Can I get your email to contact privately?

Hi

I prefer to keep discussions in the public forum where they can be useful to others.
If necessary you can PM me in this forum though.

Continuing the discussion from Arrive as group:

Says I cannot PM you. I was wondering if you are available for a paid integration? If so, can you open PM for some details?