Problems with Drawing a Circle

I am writing a script to create a circle with the volume filled in.

This is what I want:

But instead, this is what I’m getting:

I have tried multiplying the size of the with the b

	for b = 1, 3 do
		local c = b - 1

		for i = 1, 4 * (b - 1) do
			local Plane = game.ReplicatedStorage.Levels.Plane:Clone()
			Plane.Position = Vector3.new(math.sin(i * math.pi / 2), 0, math.cos(i * math.pi / 2)) * (2046*c)
			Plane.Parent = workspace
		end

	end

but it does not seem to fully work.

Here’s the full script:

function Draw_Circle()
	local Plane = game.ReplicatedStorage.Levels.Plane:Clone()
	Plane.Position = Vector3.zero
	Plane.Parent = workspace
	for b = 1, 3 do
		local c = b - 1

		for i = 1, 4 * (b - 1) do
			local Plane = game.ReplicatedStorage.Levels.Plane:Clone()
			Plane.Position = Vector3.new(math.sin(i * math.pi / 2), 0, math.cos(i * math.pi / 2)) * (2046*c)
			Plane.Parent = workspace
		end

	end
end

1 Like

I doubt that using trigonometry will help in this situation. Here’s my solution using matrix:

local rows : number = 7;
local c : number = 4;

local m : number = c - 1;
local g : number = 2 * rows;

for x = 1, rows do
    for y = math.max(rows - (x + c / 2), x - m), math.min(g - (x + m), x + m) do
         local y_pos : number = y - c;
         local x_pos : number = x;

         local Plane = game.ReplicatedStorage.Levels.Plane:Clone();
         local pos : Vector3 = Vector3.new(x_pos * Plane.Size.X, 0, y_pos * Plane.Size.Z);        

         Plane.Position = pos;
         Plane.Parent = workspace;
    end
end

Thank you, it works. Could you explain to me how this draws the circle?

1 Like

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