I want to make a procedurally generated asteroid field using perlin noise.
WriteVoxels requires arrays of the same size and the fill region.
The fill region sizes are bigger than what i want sometimes:
Halp
I want to make a procedurally generated asteroid field using perlin noise.
WriteVoxels requires arrays of the same size and the fill region.
The fill region sizes are bigger than what i want sometimes:
Halp
Might just need to adjust the step. I didn’t run a test to confirm that your code is doing what it looks to me like it’s doing, but it appears that you are maybe creating 1x1x1 regions (cubes) at 1 stud intervals and then expanding the sizes to 4. That might be 1) causing more regions to be created than you need and 2) causing some to be positioned in a way that they cross into more than one voxel grid region (so more than one voxel grid region needs to be filled in order to expand to the grid). If you put a step in the for loops so that the regions you create are already spaced by 4 to match the voxel grid, it might help.
I tried that before and it didnt work ;-;
It seems to break for everything after z = 3, infact every time it increases by 4 it wants the array to be bigger, and the region is bigger…
With this line left as it is?
local region = Region3.new(Vector3.new(x,y,z), Vector3.new(x+1, y+2, z+1)):ExpandToGrid(4)
Should still be creating 1x1x1 blocks, but just spaced out more. Weird.
(running a test… brb)
Ok so before the region gets expanded to grid, it seems like the 3rd value is increasing by 0.5 each time
When expanded, the first 3 round to 2 and the last rounds to 4
oh wow
wowowowow
(x,y,x)
not x,y,z
This works without error for me.
local terrain = workspace.Terrain
local maxX = 40
local maxY = 40
local maxZ = 40
for x = 0, maxX, 4 do
for y = 0, maxY, 4 do
for z = 0, maxZ, 4 do
local region = Region3.new(Vector3.new(x,y,z), Vector3.new(x+1, y+2, z+1)):ExpandToGrid(4)
terrain:WriteVoxels(region, 4, {{{Enum.Material.Rock}}},{{{1}}})
end
end
end
Oh, did you figure out the issue?
it seems so, thanks for trying