I am new here and am currently learning how panda3d works, I am currently following a tutorial which asked me to create terrain through a height map and then later asked me to convert this height map into a bam file, the problem is that while I followed the tutorial as it was written even going as far as copy pasting the code directly into my IDE just to make sure that I am using the right code, here is the code that I have:
from direct.showbase.ShowBase import ShowBase # import the bits of panda
from panda3d.core import GeoMipTerrain # that we need
class MyApp(ShowBase): # our 'class'
ShowBase.__init__(self) # initialise
terrain = GeoMipTerrain("worldTerrain") # create a terrain
terrain.setHeightfield("heightmap.jpg") # set the height map
terrain.setColorMap("colourmap.jpg") # set the colour map
terrain.setBruteforce(True) # level of detail
root = terrain.getRoot() # capture root
root.reparentTo(render) # render from root
root.setSz(60) # maximum height
terrain.generate() # generate
app = MyApp() # our 'object'
app.run() # away we go!
and here is the tutorial I am using: http://www.mygamefast.com/volume1/issue2/
Could you let us know what the precise problem is? Your post contains the sentence “the problem is that” but you don’t follow that up with a description of the issue. Are you getting an error message? If so, please provide it to us.
What is happening is, it is running like normal, panda opens and displays everything from the heightmap and the texture, but the line which is supposed to write a bam file based on the model created from the height map doesn’t appear to do anything, I check the root folder and there is no bam file, I even search for the file in the panda3d folder but nothing shows up. The code appears to not do anything the line
root.writeBamFile("world.bam") is intended to create a bam file, it creates nothing from what I have noticed, not even an unusable bam file so I am uncertain if there is a problem before or after.
Sorry for the confusion.
writeBamFile returns a boolean value indicating whether it has succeeded. If you print out the return value, oes it show that it returns
Is there any error message printed on the console?
when run in the IDE I get an error saying that there is no module named direct, is that the problem?
seanmach, I checked your code, and the Bam file appears next to the script file.
Check without IDE, the problem is the IDE.
Messing around with the files, I was able to change the version of python I’m using to 2.7, this seems to be what the problem was, it is fixed from the look of things I moved idle into panda3D’s copy of python and everything ran just fine, I have no clue how stable this is, but I will cross that bridge when it is necessary, thank you everyone for the help.