Similar Posts

Subscribe
Notify of
1 Answer
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
apophis
1 year ago

General:

  • You read the current coordinates of the player
  • You set a circle with a certain Raidus around these coordinates
  • You define a random point within this circle (there are mathematical formulas)
  • You let your “something” spawn at this random point

In addition, so that “something” does not spawn directly on the player:

  • You set a second smaller circle around the player’s coordinate
  • You determine that “something” in the outer, but not in the inner circle spawn.

I remember doing something like that in the first or second semester of my studies. This can be solved mathematically.

You can also find a solution with Unity’s own elements.