one spot, as if they are sometimes z-clipping?
There is none. I believe this is why: It adds offset, but without it, the meshes would z-clip (Line 78 z *= 3.732 * 0.25
)
so explain to me, because i dont understand what is the issue now?
I’m sorry that the problem is difficult. But, my issue now is placing the hexagons like the image below:
can you send the place file now?
is this what you want?
Yes, but the rotation is off by 45 degrees (my part).
you mean the thing in my image? i just stood in a weird way, its rotated normally
No the hexagons. (my bad; I’m getting there with my explanation of things)
ok, if you think you can handle the rest because i dont really understand what you mean, change the
if z % 2 == 0 then
z += 3.732 * 0.5
else
z += 3.732 * 0.25 --or maybe 0.75?
end
with
z += 3.732 * .5
thats weird, i simply change that to this and it doesnt give me stripes
It is happening on the z-axis. I don’t know what I’m doing wrong.
can you show the script? [30 сhars]
local FractalNoise = require(game.ServerStorage.FractalNoise)
local heightmapNoise = FractalNoise(nil, 0.1, 2, 2, nil, nil) --These are just magic numbers
local swirlNoise = FractalNoise(nil, .01, 5, 2) --These are just magic numbers
function mapSet(map, x, y, z, value)
map[x] = map[x] or {}
map[x][y] = map[x][y] or {}
map[x][y][z] = value
end
function mapGet(map, x, y, z)
if map[x] then
if map[x][y] then
return map[x][y][z]
end
end
end
function twirlCoordinates(x, y, z, power)
local power = power or 1
local tX, tY, tZ =
swirlNoise(x, y, z),
swirlNoise(x+1000, y, z), --Don't want the *same* twirl on each axis
swirlNoise(x, y+1000, z)
return x + tX * power, y + tY * power, z + tZ * power
end
function heightMap(x, z)
return heightmapNoise(x, 0, z)
end
function density(x, y, z)
--If you twirl with power 0, you'll just get a plain heightmap
local tX, tY, tZ = twirlCoordinates(x, y, z, 1)
tZ = tZ / (1 + y)
tX = tX / (1 + y)
local densityOffset = 0.5 + heightMap(tX, tZ) - y --Add 0.5 density so that there's a guaranteed bottom layer
return densityOffset
end
function generateChunk(mapSize, offset)
local yMax = 25
local yMin = 1
print(offset)
local x
local y
local z
local densityMap = {}
for x = 1, mapSize do
for y = yMin, yMax do
for z = 1, mapSize do
mapSet(densityMap, x*offset["x"], y, z*offset["z"], density((x*offset["x"])/mapSize, y/(yMax), (z*offset["z"])/mapSize))
end
end
end
x, y, z = 0,0,0
for x = 1, mapSize do
for y = yMin, yMax do
for z = 1, mapSize do
local d = mapGet(densityMap, x*offset["x"], y, z*offset["z"])
--print(d, x*offset["x"], y, z*offset["z"])
if d >= 0 and d <= 0.14 then
local block = workspace.blockBase.Base_Plane:Clone()
--local block = Instance.new("Part", workspace)
--block.Size = Vector3.new(4, 4, 4)
z *= 3.732 * 0.5
block.Anchored = true
block.CFrame = CFrame.new((x*offset["x"])*4, y*4, (z*offset["z"])*3.732) -- this is the positioning
block.Color = Color3.fromHSV(((y/mapSize)%1), .75, 1 - (y/mapSize))
block.Parent = game.Workspace
end
end
end
game["Run Service"].Heartbeat:Wait()
end
x, y, z = 0,0,0
end
generateChunk(16, {
["x"] = 1,
["z"] = 1
})
yeah, you put *=, you need to put += (z += 3.732 * .5)
multiplication sign and plus sign have a huge difference as you notice here
That helps, but the offsets need to be like a tile grid (that is why I had code for the x-axis)
aren’t they like a tile grid already?
Not really. Look at the difference between the image you sent me and the one I used as reference to what I want with details (excluding rotation).