Actors are spawning in a 'star' formation

You are not moving the spawn-location, the position of the spawned object are just moved because they collide with each other.
Pretty much a random result.

A better way would be to move the location of the transform.
Make it as close to a square as possible by taking the ceil of the root of the spawn-count (3 if you spawn 9) (save it as a local variable (C)
Then take the index of the for-loop, mod with C to get the column-index. Add this number (times the offset size) on the X-axis
Then take the index of the for-loop, divide with C to get the row-index. Add this number (times the offset size) on the Y-axis

That would move the spawn-point in world-space for each iteration of the for-loop

1 Like