Download

How to spawn coins in a way to not collide?

Hello everyone!

I have a problem… I am developing a game so problems will be very common… from which I will learn a lot!

My problem is about spawning coins in a way they avoid obstacles…
I have this so far (I get it from this post in answerhub https://answers.unrealengine.com/questions/434586/how-would-you-spawn-object-in-a-straight-line.html)

94324-lanes_1.png

94525-lanes_new.png

With the blueprint above, I can manipulate the lane in which they can spawn, as you can see.
But I want to manipulate the lane to not collide with an obstacle as shown in the illustration below…

Representation.png

Yellow circles represent coins.
Blue squares represent obstacles.
The big black square outline represents a simple room.

You could do a trace to see if something is blocking it. If not, spawn.
There was recently a twitch stream from Epic about traces: https://www.twitch.tv/unrealengine/v/108752783
And of course the docs:
https://docs.unrealengine.com/latest/INT/Gameplay/HowTo/UseRaycasts/Blueprints/