How to distribute parts evenly within a circle's outline?

What I’m trying to do is this:


So far example if I put the radius to 5 and put 5 parts it should do something like this:
image
What the problem is, is that I can’t figure out a way to do this within a script.
Any ideas on how to approach this is greatly appreciated.

Hi, I think, that for this work you should use sin and cos functions. Once, I looked through devforum for learn about sin,cos,tan and i found very similar post to your. I’m not good from math or trigonometry functions, but i still have formula to create circles.

Code:

local Part = game.ServerStorage.Part; -- your part

local num = 5; -- the number of parts, from which you want to create a circle
local radius = 5; -- radius of circle

local startPos = Vector3.new(0,5,0); -- the position you want to create a circle around

for i = 1,num,1 do
	local cl = Part:Clone();
	cl.Parent = workspace;
	
	local formula = (i * (math.pi*2)/num);
	
	cl.CFrame = CFrame.new(startPos) + Vector3.new(math.sin(formula)*radius,0,math.cos(formula)*radius);
	cl.CFrame = CFrame.lookAt(cl.CFrame.Position,Vector3.new(0,startPos.Y,0));
	
end

I hope this helps.

3 Likes

Thanks, sorry for the late reply. I’ll test it out

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