Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- > please keep in mind i have never used terrain before
- -- >> the writing of this script, so things may look vague
- -- size (?)
- -- width,height,depth
- local size = 128
- local w,h,d = size,size,size
- -- list of occupancy
- -- list of materials
- local ls_occ = {};
- local ls_mat = {};
- -- region, resolution
- -- the size is (w,h,d)*4 (?)
- local region = Region3.new(Vector3.new(0, 0, 0), Vector3.new(w,h,d)*4):ExpandToGrid(4);
- local resolution = 4;
- local mats = {
- [0] = Enum.Material.CrackedLava,Enum.Material.Rock,
- Enum.Material.Ground, Enum.Material.Grass,
- Enum.Material.Water, Enum.Material.Air
- }
- -- make a 32x32x32 block of rock
- for z = 1,d do ls_occ[z],ls_mat[z] = {},{}
- for y = 1,h do ls_occ[z][y],ls_mat[z][y] = {},{}
- for x = 1,w do
- local n = (math.noise(x/w*6,y/h*6,z/d*6) + 1)/2
- ls_occ[z][y][x] = n
- ls_mat[z][y][x] = mats[math.floor(n*6)]
- end
- end
- end
- -- make a 32x1x32 slice of water, at the top
- for z = 1,d do
- for x = 1,w do
- --ls_mat[z][d][x] = Enum.Material.Water;
- end
- end
- workspace.Terrain:WriteVoxels(region,resolution,ls_mat,ls_occ);
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement