i am trying to create a 3 dimensional grid of cells which are on or off (think minecraft clone). in c i would have a 3 dimensional array of bools (essentially) to denote if the cell was on or off and draw() would draw a cube if the cell was ‘on’ and would do nothing if the cell was ‘off’.
in panda3d (python) i have written this code:
block = loader.loadModel("media/cube") block.reparentTo(render) block_scale = 0.5 block.setScale(block_scale, block_scale, block_scale) block.setPos(0, 0, 0)
essentially, i guess my question is, how would one go about making a 64x64x64 grid of ‘blocks’ without calling loader.loadModel() 64x64x64 times?
so for example, i want to setPos() on each block as a factor of the index for that block in my 3 dimensional array analogy. so block might be drawn centered at position (2.0, 17.0, 31.0). however i only need to setScale() once because each block is drawn identically. thanks in advance to any help.