How to create a bundle of objects?

There’s a very easy way to do this - just using a for next loop.
Make a var for rows and one for columns. - Make these both 10 so you end up with a 10 by 10 grid of whatever you’re spawning
Make a for loop from 0 to ROWS.
Plug the loop body execution pin into another loop from 0 to COLUMNS
Plug the execution body pin of that one into a SpawnActorFromClass node.

Then you just need to make a function to define the transform for each SpawnActorFromClass call.

To do this drag left off the transform pin on the SpawnActorFromClass node and choose ‘Make Transform’, then from this new node drag off the location pin and choose ‘MakeVector’

Now you can build a function into the X and Y pins based on the index pins from both your loops.

For example drag off the first index and type multiply to get a multiply node and enter 10 into the second box. (10 is the gap between objects - you should make this a variable too)
Do the same for the other index node.

Plug those values into the X and Y pins of your make vector node.

Don’t forget to wire your first loop into an OnBeginPlay node or something, also you need to actually put an object to spawn into the SpawnActorFromClass node.

Tweak the values and you’ll get the hang of it

1 Like