So I’ve been following a tutorial for voxel world generation by Real Robots, and wanted to add trees. But as someone who is relatively new to Godot I can’t quite figure it out. This is the code where I assume it is supposed to be handled:
func GetBlock(pos : Vector3i):
var n = (noise.get_noise_2d(pos.x, pos.z) + 1) * chunk_size
if n > pos.y: # if the noise is greater than a certian y position.
if cave_noise.get_noise_3d(pos.x, pos.y, pos.z) > -0.5:
return Block.BlockType.Grass
else:
return Block.BlockType.Air
else:
return Block.BlockType.Air