I am wanting to make a planet generation script but using a spherical mesh, then applying noise to it, like how ive done it in blender (its noise on a uv sphere with a different sphere with no noise for water).
There are great tutorials on yt for this kind of stuff. I believe Sebastian Lague does a good tutorial however it is written in c# so you will need to convert the code
local size = 10
local amplitude = 0.5
local sphere = game.Workspace.Sphere
local as = game:GetService(“AssetService”)
local editableMesh = as:CreateEditableMeshFromPartAsync(sphere)
local vertices = editableMesh:GetVertices()
for i, vert in pairs(vertices) do
local pos = editableMesh:GetPosition(vert)
local normal = editableMesh:GetVertexNormal(vert)
local noise = math.noise(pos.Xsize,pos.Ysize,pos.Zsize)
editableMesh:SetPosition(vert,pos-(normalnoise))
print(noise)
end
The code sample provided doesn’t parent the EditableMesh to anything, so it won’t show up anywhere, but also the amplitude variable is not being used anywhere. It should be used in this line:
editableMesh:SetPosition(vert, pos - normal * (noise * amplitude))