Colour Wheel Rendering

Hi there. I’m currently trying to render a colour wheel in roblox (draw it from scratch). Currently, it’s going not terrible BUT not how I wanted it to go.

The issue is seen here:

It starts off well then just cuts off. I would like to know how to fix this, any solutions?

We’re definitely not going to be able to help you fix the script unless you post the code here.


local rs = game:GetService("RunService")

local h, s, v = 0, 0, 1

function polar(v)
	return math.atan2(v.y, v.x), v.magnitude
end
	
function toDeg(x)
	return (x * (180 / math.pi))
end

local pixels = 1

local rows = wheel.Size.Y.Offset

for i = 0, rows, pixels do
	for j = 0, wheel.Size.X.Offset, pixels do
		local new_colour = Instance.new("Frame", wheel)
		new_colour.BorderSizePixel = 0
		new_colour.Size = UDim2.new(0, pixels, 0, pixels)
		new_colour.Position = UDim2.new(0, j, 0, i)
		local r = wheel.AbsoluteSize.X / 2
		local d = Vector2.new(new_colour.AbsolutePosition.X, new_colour.AbsolutePosition.Y) - wheel.AbsolutePosition -  wheel.AbsoluteSize/2
		if (d:Dot(d) > r * r) then
			d = d.unit * r
		end
		print(r, d)
		local phi, len = polar(d * Vector2.new(1, -1))
		h, s = toDeg(phi)/360, len / r
		new_colour.BackgroundColor3 = Color3.fromHSV(h, s, v)
		rs.Heartbeat:Wait()
	end
end

I am not sure why but the wheel looks a bit like a block rather than a thin cylinder tipped on its side as in wheel shaped. Wont fix your script but will make the view appear to be in line with it.

I was just rendering it as a block prior to making it circle. Could you help me with rendering it as this… weird cyclind you mentioned? ^-^

Can you please show us the explorer view of wheel.