adjust spawn on x or y
currently i have a number of set spawn points around a level and am spawning all enemies from these spawns. i have it set to ajdust the spawn if it collides but this is expectantly causing adjustment on the z axis as well. i would like to restrict this so it can only adjust on the x and y as the game is from the top down shooter. Any ideas on how i can achieve this? Still quite new to UE4 overall i would say. I have been using the normal Spawn Actor from Class node for this and spawning them on a target point.
Here is an image of the adjustment somewhat working in this corner however the yellow boxes in the top left have still spawned inside each other despite collision. (Yellow box in bottom right is out of map)
Here the boxes have spawned on the z axis and this both cannot hit the player and the player cannot hit it as it is too high up, spawning above the first box.
Lastly here is a screen of a number of enemies spawning just under the map due to adjustment on the z axis again.
asked Feb 06 '18 at 09:10 PM in Blueprint Scripting
There may be a way to do it using your spawn method as it is. But you could always do it yourself.
Before you spawn an actor, use Sphere Overlap Actors to probe the spawn location. If you get overlaps then adjust the spawn location yourself so you can ignore the Z component. There is also Box Overlap Actors if you want to get a nice tight fit for box-shaped actors. And there is Capsule Overlap Actors to get a tighter fit for capsule-shaped actors (like humanoid characters).
Once you get a good location you can spawn them as "Always Spawn, Ignore Collisions" and it will spawn exactly where you tell it to (i.e. on your desired plane).
And you may want to test an area that is a bit larger than the spawned actor. That is, if things will be moving around during spawns (which they usually are). The larger area will account for the movement so you can be sure that by the time the actor is fully spawned, nothing has moved into its actual spawn area.
Hope that helps if you can't find a built-in way. Good luck!
answered Feb 06 '18 at 09:55 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here