Browse Source

Improve flat terrain generation in the Voxel demo (#1189)

This adds 2 layers of dirt below the grass layer and a layer of indestructible
bedrock below it so you can't fall off the world.
Hugo Locurcio 4 months ago
parent
commit
c05d05009b
1 changed files with 4 additions and 1 deletions
  1. 4 1
      3d/voxel/world/terrain_generator.gd

+ 4 - 1
3d/voxel/world/terrain_generator.gd

@@ -27,7 +27,10 @@ static func flat(chunk_position: Vector3i) -> Dictionary:
 
 
 	for x in Chunk.CHUNK_SIZE:
 	for x in Chunk.CHUNK_SIZE:
 		for z in Chunk.CHUNK_SIZE:
 		for z in Chunk.CHUNK_SIZE:
-			data[Vector3i(x, 0, z)] = 3
+			data[Vector3i(x, 2, z)] = 3  # Grass.
+			data[Vector3i(x, 1, z)] = 2  # Dirt.
+			data[Vector3i(x, 0, z)] = 2  # Dirt.
+			data[Vector3i(x, -1, z)] = 9  # Bedrock (can't be destroyed due to its Y coordinate).
 
 
 	return data
 	return data