I am messing around fibonacci spheres and wanted to know how I would generate faces between points generated on the sphere, and I have hit somewhat of a roadblock.
-- Parameters
local numPoints = 300 -- # of verts
local radius = 200 -- Radius of planet
-- Create sphere verts
local function fibonacciSpherePoints(numPoints, radius)
local points = {}
local goldenRatio = (1 + math.sqrt(5)) / 2
local angleIncrement = math.pi * 2 * goldenRatio
for i = 1, numPoints do
local theta = angleIncrement * i
local y = 1 - (i / numPoints) * 2 -- Distribute verts along the y-axis
local radiusXY = math.sqrt(1 - y * y) * radius
local x = math.cos(theta) * radiusXY
local z = math.sin(theta) * radiusXY
table.insert(points, Vector3.new(x, y * radius, z))
end
return points
end
local function createSphere()
local spherePoints = fibonacciSpherePoints(numPoints, radius)
local parent = Instance.new("Folder")
parent.Name = "FibonacciSphere"
parent.Parent = game.Workspace
for _, point in ipairs(spherePoints) do
local part = Instance.new("Part")
part.Size = Vector3.new(1, 1, 1)
part.Position = point
part.Anchored = true
part.Parent = parent
end
end
createSphere()
Does anybody have any insight on how I might go about doing this?