So, I made a blueprint to randomly spawn physics-simulated rocks within a volume.
Naturally, if any 2+ rocks spawn clipping each other, they’ll fly in opposite directions from the phantom physics impulse. So is there a way I can say “after the random location is generated, check if rock is colliding with anything, if so, make a different random location”?
Here’s a few more things about the blueprint in case they matter:
-The mesh components and their locations/rotators are generated at EventBeginPlay.
-I use floats to generate the locations, as seen in the screenshot below.
-There is an editor-exposed variable that controls the number of rocks to spawn. I’d like to keep this feature, but it would obviously need a limit since only so many rocks can be spawned in a set volume without clipping. So bonus question!: how would I go about calculating a percent-based “density” variable instead of “number of rocks”, where 100% would be the maximum amount of rocks that can cleanly fit in the volume?
I’m mainly a 3D artist and not a programmer, so if anything else about my blueprint looks stupid or inefficient please let me know, I’m here to learn.
Thanks!