Say I have a cube and I want to spawn another cube on the left side of my first cube, how would I achieve that?
Well yeah but say I wanted to spawn a 1000 actors, all next to each other. I would need to do it through blueprints without using spawn points, I just don’t know how I can spawn them next to each other.
You will have to use a for loop and increment the vector. You could start with a vector (0,0,200) or something and in each iteration of the for loop, you just add
ForLoopIndex * 10 + Vector.X
So you have (0,0,200) -> (10,0,200) -> (20,0,200) etc.
That doesn’t help me if the sizes of each actor is different. Say I have a box sized 4 by 4 by 4, and another sized 3 by 2 by 1, I would want them to be placed exactly next to each other, I want to know how I would achieve that.
Can you be specific with exactly what you’d like to do? You got two answers but added an additional requirement for each.
Yeah sorry, so basically I am creating cubes of different lengths and I want to place one cube in front of the other, and then another cube right after that, and so on. So something like this:
After the long cube, I want to place another cube starting from its edge. I want to keep on doing that, assuming each cube is a different size.
Well, assuming each cube has its own BP, then you can simply add two points to the cubes: one to tell the next cube where to spawn, and one to tell itself where to spawn.
Spawn cube -> set in variable -> use variable to get spawn point for the next cube -> spawn next cube -> repeat
I actually use this method for my building system.
Hope that makes sense! GL.