I am trying to turn a cube into a circle by normalizing the cube using the method in this topic by PapaBreadd in post 4, but I’m having the same problem as the original poster, being that it makes the cube look like this.
The solution didn’t help me at all. Although, it did say something about “Setting the points around the origin” (which in the original poster’s case was 0, 0, 0).
This is my code:
local runService = game:GetService("RunService")
function generateSphere(center, size)
local verticesOnCube = {}
local verticesOnSphere = {}
local i = 0
for x = 0, size do
for y = 0, size do
for z = 0, size do
i = i + 1
verticesOnCube[i] = Vector3.new(x, y, z)
end
end
end
for i, o in ipairs(verticesOnCube) do
local xyz = Vector3.new(o.X, o.Y, o.Z)
verticesOnSphere[i] = (xyz - center).Unit + center
local sphereVertex = verticesOnSphere[i]
local part = Instance.new("Part")
part.Position = sphereVertex * 10
part.Anchored = true
part.Size = Vector3.new(1, 1, 1)
part.Parent = workspace
runService.Heartbeat:Wait(5)
end
end
--////////////////////
local center = Vector3.new(0, 0, 0)
local size = 10
generateSphere(center, size)
Any help would be appreciated. Thank you!