I’m trying create a hexagon sphere (not with too many hexagons to lag) so I can detect if a certain part of the hex sphere is hit to emit a particle at that particular place but i’m having trouble with it. What can I do to make it form in the way I wan’t it to?
local function fibonacci_spiral_sphere(num_points)
local vectors = {}
local gr = (math.sqrt(5) + 1) / 2
local ga = (2 - gr) * (2 * math.pi)
for i = 1, num_points do
local lat = math.asin(-1 + 2 * i / (num_points + 1))
local lon = ga * i
local x = math.cos(lon) * math.cos(lat)
local y = math.sin(lon) * math.cos(lat)
local z = math.sin(lat)
table.insert(vectors, Vector3.new(x, y, z))
end
return vectors
end
local origin = Vector3.new(0, 0, 0)
local radius = 10
local ref = Instance.new("Part")
ref.Anchored = true
ref.Size = Vector3.new(5,0,5)
local folder = Instance.new("Folder", workspace)
local vec = fibonacci_spiral_sphere(1024)
for i = 1, #vec do
local part = ref:Clone()
part.CFrame = CFrame.new(origin, vec[i]) * CFrame.new(0, 0, -radius)
part.Parent = folder
wait()
end