How To Make NPCs Surround Player?

I’m currently trying to make NPCs surround the player with a bit of randomness. What I mean by this is that the NPCs will not have exact pre-determined positions around the player but they will stay inside the players area and basically surround the player in an overall circular form. To give you a better understanding, here’s an example I made:

Current:

Goal:

Orange = Maximum distance
Yellow = Minimum distance
Blue = Player
Red = NPCs

How would I be able to achieve this?

Theres definitely a more efficient way of doing this however, my method would be getting the players position as a CFrame, then rotating on the Y axis by math.random(0,360) and get a positional value by multiplying that CFrame by whatever the minimum distance is to get a randomized surrounding function.

2 Likes

I’ll definitely give this a try!

I would use some epix math here

you can like use Pi, cos and tan to get the x,z axis so you could “surround” the player, for the orientation I’m not sure