Spawn actors on top of eachother

Currently trying to spawn actors into my level and stack them on top of eachother. The actors are simple box shapes of equal size except for the height (scale). The height (scale) is set randomly.

I currently have the following blueprint for spawning:

This is currently not working correctly since it still spawns the actors through eachother. I need them to stack on eachother neatly but I can not figure out how to.

1 Like

You need 2X the bounds Z, because the bounds only show the distance from the center of the object to the edge.


Okay, so your blueprint example looks neat and clean, so thank you for that nudge. However, I tried to translate it into my blueprint and things still do not turn out as good as yours. Maybe the difference is because of you using a static actor and I use Blueprint->Actor? I don’t know, I’m new.

Here’s my current setup and result. The weird thing is, there are 4 blocks spawned and only 2 gaps show, so one of the blocks must be spawning correctly or is spawning through another one. I hope you can see what I did wrong.

Code looks good. If it’s a blueprint, you might as well put an arrow component ( or something similar ) at the top of the cube, that way you can tell where this suspect block is going.

That’s a good idea sir, thank you. I think I will manage in the end, you helped me closer and I think your answer was correct so I will mark it as so. Thanks!