Hello! I am trying to figure out how to handle a custom overlap/collision scenario for a test project and keep running into dead ends or functionality that isn’t quite what I need.
To flesh out how I have things set up, I have a blueprint actor that spawns a model (a child static mesh) during runtime. Once these models are spawned I randomly place the spawning actor within a trigger volume.
One of my requirements is that no two models should overlap with each other. The first attempt I made was using a Get Random Point in Bounding Box and a Spawn Actor From Class node with the Collision Handling set to Attempt to Adjust but always spawn.
The Spawn Actor was created and place before the models were spawned which was causing the collision handling to not work as there was no collision mesh to work with. I then changed it so that the Spawn Actor is created before placement and made the model spawn before placing it at random within the volume but now I need to figure a way to handle the collision/overlap issue. At first I thought maybe a Sphere Collision but that didn’t work entirely the way I wanted it to. Instead I have implemented a Sphere Overlap which works in terms of detection as I need it to but now my problem is moving the spawned models if they are overlapping another model.
So far I have tried getting the location of the model being overlapped, multiplying it by -1, and then multiplying that by various values. I then break the vector output on the multiple vector/int and the location input on the Set Actor Location then use only the x and the y axes. For whatever reason, more often then not half of the models vanish from the level and the ones left do not move along the y-axis, only the x-axis. I also tried using the Get Unit Direction Vector node and doing the same thing with the output location as indicated above with the same results.
I have tried subtracting the locations and then adding to the output but that also had the same results as the other two. I get the overlapping actor’s location from the On Begin Overlap’s Other Actor node into a Get Actor Location node. I do the same on a “Self” node for the overlapped actor. Both actors are the Static Mesh which is a child component of the Spawner Actor.
Pretty much out of ideas at this point. There seems to be nearly no discussion of this type of scenario as far as I could find in four hours of Googling. What I have found has not been very helpful though did point me in the directions I attempted above.
Does anyone have any thoughts on how I can achieve this? Do I need to try and move the Spawner Actors instead of the static meshes?