Hey there! I am actually the original author of that post, while the original thread is for cylinder shapes, it’s luckily pretty easy to convert to a sphere.
Really all you need is the y axis (as well as a theta angle) to convert the pre-existing code, which can be calculated using the following line
for theta = 0, 180 do
local y = r * math.cos(math.rad(theta))
end
EDIT: I fixed it, I just added the original Y value as “l”
local center = cframe.Position
local h,l,k = center.X,center.Y,center.Z
if light:IsA("PointLight") then
for i=1,360,numSamples do
local rad = math.rad(i)
local x = h+radius*math.cos(rad)
local z = k+radius*math.sin(rad)
for t=0,360,numSamples do
local y = l+radius*math.cos(math.rad(t))
local n = Vector3.new(x,y,z)
DrawLine(center,n,(center-n).Magnitude,folder)
end
end
end
Do you know how I could make it so that the higher the number of samples, the higher the amount of rays rather than the lower number of samples, the higher amount of rays?