How can I spawn actors a certain distance away from the player?

So I’m making a space game where you fly a ship around. I want to spawn meteors but only when they are just outside the players view (Which Is Limited By Fog). I have tried spawning them using “random location in bounding box” But this causes them to spawn inside the view distance. Is there a way to set up a circle like the one below, to spawn them ONLY outside it’s radius?

Nevermind, I found out how to do it, for those wondering the same question…

I took the world location of the ship, and added the radius to its X axis. Next you subtracted that value from the ships X axis. Next you make a vector using that new X axis you made, and rotate the vectors yaw, by a random float between 0-360. And after all that, add that new vector to the original. This will make a circle around the ship that follows its location.

Image from Gyazo

Swap Random Float for a fixed distance, if needed.

2 Likes

Rotating a vector can be simplified to:

350029-screenshot-7.png

There are as many ways of doing this as there are people, surely.

Thank you, this seems much more reasonable and efficient!