Download

How to spawn random meshes in an array in a random location safetly?

I’m wondering how I could go about making an array of random meshes, then spawning it in a random location, but safely, so not inside other meshes. I know I can do simulate physics to have them drop when the player spawns in (there won’t be too many) and an overlap trigger that destroys the actors if they spawn outside of rooms. Any idea the best way to go about this?

Make an array of random meshes:
you can create array_A of staticmeshes and set like 10 type, than making an array_B loop to fill in a “random integer in range” and get a random array_A staticmesh.
Spawn them safely:
this really depend on the type of staticmeshes and structure of the level-game but:
You can set the collision of a staticmesh to simple or complex, and check if an actor, is overlapping another actor (staticmeshactor)

if the actor is overlapping you have to move it or respawn , and check again