Hi,
I want to stack several randomly chosen static meshes on top of each other using a For Loop. The meshes are selected from an array.
The problem: the meshes have different heights, so I can’t just multiply the loop index by a fixed Z offset. I want each mesh to be placed directly above the previous one, regardless of its size.
I’ve spent two weeks trying numerous approaches using GetComponentBounds, offset math and more – but nothing worked reliably.
I have not posted any screenshots because I have tried so many different things and honestly don’t know anymore what I’m even doing. I feel completely stuck at this point.
Does anyone have an idea how I should best approach this? I’d really appreciate any input. Maybe someone knows tutorials or similar resources on this topic because I haven’t found any.
Spawn the new mesh under the map and get its bounds (z). Do a trace from above the last stacked mesh. Take the hit location and pad the Z with half the bounds of the new mesh. Then teleport the new mesh.
Adding static mesh component, setting random mesh from array, getting that mesh local bounds, taking away min z from max z and adding it to current z (default 0).
You can easily edit pivot point using modeling tools.
Drag static mesh you want to edit into a level. Switch to modeling tool.