Consider i have this part’s Position and i want to gather information about its proximities. What I specifically need is the positions of a circle around the part, sort of like this:
So it calculates a circle area around the part and gets me back the position of each of those yellow circles.
I also need the amount of lines and line distance to be modifiable. The amount of lines being modifiable basically means i can just send like 6 lines like the previous example and get back 6 positions or something like this, that gets me a lot more positions:
This is best solved with a bit of really basic trigonometry, more specifically the sin() and cos() functions.
You’re interested in the way those functions are related to each other, when it comes to the unit circle. I’m not really good at explaining, but there are plenty of resources available online for you to understand why this is the case.
local centre = Vector3.yAxis * 5
local partAmount = 10
local radius = 5
for index = 1, partAmount do
-- pi*2 is a full circle
local angle = (index - 1) / partAmount * math.pi * 2
local offset = Vector3.new(math.sin(angle), 0, math.cos(angle)) * radius
local part = Instance.new("Part")
part.Position = centre + offset
part.Size = Vector3.one * 1
part.Parent = workspace
end