#making planet

4 messages · Page 1 of 1 (latest)

carmine bridge
#

so bassically about this planet im makin its fine and all but when i try to increase the over all size with the radius some parts of it stops loading imma send the script rn

#

Main module

function GetBlock(x, y, z)
    -- Noise parameters
    local noiseScale1 = 35 -- controls the values over the bigger the smoother the planet
    local noiseScale2 = 20 -- small details
    local noiseIntensity1 = 40 -- over hangs caves
    local noiseIntensity2 = 0.1 -- big value floating rocks like 20 is too high
    local radius = 700

    -- Center and radius of the sphere
    local center = Vector3.new(MapSize / 2, MapSize / 2, MapSize / 2)
    local blockPos = Vector3.new(x, y, z)

    -- Calculate the distance from the center of the sphere
    local dist = (blockPos - center).Magnitude

    -- Noise generation
    local noise1 = math.noise(x / noiseScale1, y / noiseScale1, z / noiseScale1) * noiseIntensity1
    local noise2 = math.noise(x / noiseScale2, y / noiseScale2, z / noiseScale2) * noiseIntensity2

    -- Adjust the radius with noise to create surface variation
    local adjustedRadius = radius + noise1 + noise2

    -- Calculate the sphere's boundary with adjusted radius
    local sphereVal = adjustedRadius - dist

    -- Clamp the value to ensure it only generates within the sphere
    local val = adjustedRadius - dist

    val = math.clamp(val, -5, adjustedRadius)

    return val, math.clamp(sphereVal, -5, adjustedRadius)
end
#

settings:

    Seed = 0,
    MapSize = 2000,

    ChunkSize = 30,
    BlockSize = 9,
}```