Maybe a better explanation of what I’m trying to do would help:
Essentially, I want to create a 3D tile-based game. I’m not familiar with Python so I’m writting a few experiment programs and one of them is the TileMap ‘engine’.
Before working with 3D stuff, I worked with 2D… actually, that was a long time ago but the concepts I used in the 2D games seem to be able to be adapted to 3D… I just don’t work with the up/down component.
Essentially what I’m trying to accomplish is an effective method or reading in a list of values. I can do the reading part and I can do the array part (I’ve figured that out finally with Python… just requires some extra work).
The question now is that I want to, while setting up the scene, run through the array, read the value of each element and then ‘place a tile’ based on that value (e.g., value 1 = marble floor, value 2 = grass).
I have a 3D model that represents a tile… using Panda3D’s dimensions of 1x1… simple enough. But, loading in a new copy of every single tile seems redundant and extremely inefficient… so I use the loadModelCopy function so I only load the model once.
The problem now is that I need to reparentTo each ‘instance’ of this model. But what if I want a new texture at any given point? setTexture() doesn’t seem to work as well as I’d hoped.
So thats’ the first part: laying down tiles.
After that, I wanted to lay down building geometry, e.g. walls. So let’s say that I have eight styles of wall: North, South, East, West, North East, North West … and so on… each wall for a particular edge of a ‘tile’ and for corners.
I think I may have just figured it out as I’m describing it here… but I’d still like some input to see what others come up with.
As a seperate note: I can’t seem to get setTexture() to work… I’ve used the examples in the manual but it’s just not happening. I’ve also noticed in the console window that it says "unable to load texture at path … ". When I add an extension to the path name, I don’t get the error message but the texture still doesn’t change. Is there a bug/quirk in Panda3D that I’m not aware of or am I just doing something wrong? My code looks like this:
model = loader.loadModelCopy("someModel")
tex = loader.loadTexture("someTexture") # also using a '.jpg' extension
model.setPos(0, 0, 0)
After this, the model continues to use the texture set in its internal texture definition. Should I remove the texture from the model before loading it into Panda3D or is the texture supposed to be in the same directory as the model itself? (I have the texture in a totally different directory than the model).
Thanks again for the help!