Spawning random meshes at random places within bounding box

Really struggling with this… I have made zero progress, so have nothing to share.

Can someone please help me with a construction script to create a blueprint (not using the PCG plugin) to add random meshes, with random (non-overlapping) positions within a bounding box.

I would like to be able to specify how many meshes are applied. I would like to edit the size of the bounding box each time I use it in the editor.

This is for use in the editor - not runtime.

Thanks in advance!

This will get you most of the way

the only other thing is non-overlapping, which I must have covered a dozen times, but can’t find it right now. You basically have to record all the locations you’ve used and check the new random point against them :slight_smile:

Thanks for responding!

The issue I have is that I’m trying to do this in a Constructions Script - the Spawn Actor From Class node is Event Graph only… I need this blueprint to help me create scenes not in runtime…

I can follow your flow to get location/random points in the box, but I just can’t work out how I then get that to pull meshes from a Static Mesh Array I have and place them… :frowning:

You can’t spawn in construction, then you can use ‘add static mesh component’.

If you need to actually place the separate meshes in the world, and don’t want construction to run again, then you just put a node in the event graph like this

( some other stuff after that, depending on your use case ). Notice, the node is callable from the editor

As above. But you only need to do that if you’re not happy with the placement from the construction script, for some reason. Like I say, most of the time ‘add static mesh component’ is enough.

If you can show me a concrete example, I’ll give you some hints :wink:

I got there in the end, using this BP as a basis and fussing around with it to put my array of meshes in…