How to get a Position within a radius of another Position?

Hello!
I’ve been making a game recently that is very similar to a pretty popular game called Bee Swarm Simulator, and in this game there are Monters that when killed drop Loot in form of small Tokens you can pick up, these tokens spawn in a circle shape around the Enemy’s Position after its killed.

image

Im trying to replicate how these Loot Tokens spawn in my game, but can’t seem to find a good way of getting a Position for each Token around the radius of a Killed Enemy’s Position.

I’ve tried using this method:

local Theta = -0.11; 
local LAST_ENEMY_POSITION = script.Parent.Position;
local RADIUS = 6;

script.Parent.Part2.Position = Vector3.new(LAST_ENEMY_POSITION.X + RADIUS * math.sin(Theta), LAST_ENEMY_POSITION.Y, LAST_ENEMY_POSITION.Z + RADIUS * math.cos(Theta));

But it seems very hard to use, because it uses a Theta Variable which im not very fond of because it’s very confusing, example:

With a Theta value of 0, we get this scenario:

The Green Part stays on the same X Axis to the main Part (The Blue one), which is expected.
image

Now if i go to a Theta Value of 360, you’d assume the Part should stay on the same X Axis as the main Part, but just on the other side, but no:

image

I might be very stupid and not understand how this works, but i would love some clarification on how to use this method or if another method exists.

Thanks for reading!

From what I remember, math.sin() and math.cos() work with radians angles, not degrees. You could either use a Theta value in radians, or write math.sin(math.rad(Theta)).

1 Like

This worked :sweat_smile:

I feel so dumb rn for not remembering that, thanks so much though!

1 Like

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.