Actor checks for avaliable space
I have a "controller" in my game that takes care of spawning actors in a random location in the scene. I wanted to know if there is a way to have an actor check to make sure it doesn't overlap another actor, before it spawns?
Currently I just have my timer that spawns the actor every 1 sec, in a random x and y location, using the random expression.
Comments
An easy work around is to spawn the actor and then evaluate if it's overlapping something. For example, in your spawned actor create a rule that states:
When actor overlaps or collides with YourActor
You would then evaluate again and again until the rule doesn't trigger. Then you know that you're not overlapping another spawned actor.
@Braydon_SFX
Ok thank you that did work. Only thing now is when it does spawn on another actor, it changes locations but kind of flashes (like a glitch), then moves both actors.
I was actually just watching video I just found by @tshirtbooth. It's exactly what I am trying to accomplish but one of the steps seems very time consuming lol. He suggested making a table that had all the spawn points I want. That's alot os points to add to the table.
Im hoping that since the video is 3 yrs old it has a little bit faster way lol
Spawn an invisible utility actor that seeks out the position, when located it spawns the main actor into a 'safe' location - the utility actor is set so that it does not collide with (so will not move) the main actor.
Utility actor . . . .
When actor overlaps or collides with the main actor then do @Braydon_SFX's code
Otherwise spawn main actor and destroy (itself).
@Socks
Thank you! That helped with the small issue I had.