Ahh, I see. This gets a little tricky because instead of the followers being relative to the leader, they instead should be relative to the offset of the leader. I haven't tried it myself but if you first apply an offset to the leader to get the center you should then be able to calculate a second offset for each unit.
Hi Justin,
Indeed that is what i am attempting, however having trouble applying the offset correctly, in some cases it works in others is not the following code was trying to apply the offset based on the +/- sign of the marker's world position and as i said sometimes it is fine sometimes or it fails completely.
I tried all the adding subtracting combinations to no avail. I am sure i am missing something. Offsetting the leader's destination should works and it does just need to figure out the correct way to offset it.
private void CenterOffsetTargetDestination()
{
this.targetDestination = this.formationAgent.MeUnit.MyGroup.DestinationMarker.transform.position;
this.targetPosOffset.x = (float)(separation.Value.x * formationRowsCnt) / 2.0f;
this.targetPosOffset.z = (float)(separation.Value.y * formationCollumnCnt) / 2.0f;
this.offseted.x = targetDestination.x < 0 ? targetDestination.x + targetPosOffset.x : targetDestination.x - targetPosOffset.x;
this.offseted.y = targetDestination.y;
this.offseted.z = targetDestination.z < 0 ? targetDestination.z - targetPosOffset.z : targetDestination.z + targetPosOffset.z;
if(isFormationLeader)
Debug.Log(this.formationAgent.Name + " R: " + formationRowsCnt + " C: " + formationCollumnCnt + " " + targetDestination.ToString() + " + " + targetPosOffset.ToString() + " = " + offseted);
}