[media]
[/media]
Algorithm:
Given a group of objects and a goal.
STEP 1 - Find the center of the group.
STEP 2 - Find the path from the center to the goal (it's a list of points).
STEP 3 - For each object, send it to its formation position (relative to group's position).
STEP 4 - Move the objects.
STEP 5 - Repeat STEP 4 If at least one object moved.
STEP 6 - If the goal is not reached, grab the next position of the path and go to STEP 3.
STEP 7 - End.
As you can see it's not perfect, If you have any idea how to improove it, I would thank.