Scripting HelpersARCHIVE
A little piece of Roblox history. Preserved for everyone, one question at a time.Read about the archive →
✓ ANSWER ACCEPTED

How can I get CFrames in a circle around a certain point with equal distance between them?

As the title says I need to find points circled around a point on a certain distance between the main point. So for example if you want to position your parts around the main part you would want to take the parts CFrame and then multiply it by CFrame.new(5,0,0),CFrame.new(-5,0,0),CFrame.new(0,0,5),CFrame.new(0,0,-5). If I want to add another point In between two other points I set the parts CFrame to the x/2 one of the first and z/2 of the second. But this way I will have to script everything manually because while some points have changed X's while others have changed Z's and I cant do it as many times as I want. Any help wil be appreciated.

1 answer

✓ Accepted answer

Look up parametric circle equations, but the jist of it is basically

x = sin(t) * radius
y = cos(t) * radius

or

x = cos(t) * radius
y = sin(t) * radius

So, you could do something like

function getPoints(pointsAroundCircle)
	divisor = pointsAroundCircle / 2
	points = {}
	for i = 1, math.pi * 2, math.pi/divisor do
		x = cos(i) * radius
		y = sin(i) * radius
		table.insert(points, {x, y})
	end
	return points
end

This discussion is preserved as it was. New answers, comments, and votes are closed.