Scripting Helpers is winding down operations and is now read-only. More info→
Ad
Log in to vote
-1

A problem with a sphere generating algorithm? Math help.

Asked by
LuaQuest 450 Moderation Voter
9 years ago

So basically, there's not much my code has to offer here. Hopefully it provides enough of a foundation for someone to provide a mathematically correct explanation explaining what i could use to make an algorithm that generates a sphere. I know it has to be in the for loop statement, making the "radius" variable interfere with the max integer in the for loop (360).

local radius = 10
local spawn = CFrame.new(0,10,0)

for i = 1,360 do
    local part = modules.makepart()
    part.CFrame = spawn * CFrame.Angles(0,math.rad(i),math.rad(i)*radius) * CFrame.new(radius,0,0)
    print(i)
    wait()
end
0
What exactly do you want your sphere to be? Points randomly distributed over the surface? A smooth surface? BlueTaslem 18071 — 9y
0
Anything that provides an algorithm that generates a spherical shape. Pretty much my only problem here is the math, anything else i can take care of. I've only recently taken an interest in math, so any kind of example would be more than enough to help me learn off of. LuaQuest 450 — 9y

Answer this question