This code generates a set of voxels in a radius of amt. They have no z height and I would like to implement a Perkin noise heightmap to this, but need help to integrate it:
amt = 128
for x in range (-amt, amt):
for y in range (-amt, amt):
pos = [x, y, 0]
block_positions = [ ]
if pos not in block_positions:
block = Scene.addObject(Cube)
block.worldPosition = [x, y, 0]
block_positions = block_positions.append (pos)
import mathutils
xRange = 100
yRange = 100
for x in range(xRange) :
for y in range(yRange) :
Added = own.scene.object('cube', own, 0)
position = [x, y, 0]
H =2
lacunarity =. 5
octaves = 4
z = mathutils.noise.fractal(position, H, lacunarity, octaves, noise_basis=noise.types.STDPERLIN)
Added worldPosition= [x, y, z]
#untested