my code:
from panda3d.core import Point2,Point3,Vec3,Vec4
from direct.showbase.ShowBase import ShowBase
gamemap=[1,1,1,1,1,1,
1,1,1,1,1,1,
1,1,1,1,1,1]
class Load(ShowBase):
def __init__(self):
ShowBase.__init__(self)
self.map()
self.character()
self.tree()
def loadObject(self,tex = None, pos = Point2(0,0), depth = 45, scale = 1,
transparency = True,rot=0):
obj = self.loader.loadModel("plane")
obj.reparentTo(camera)
obj.setPos(Point3(pos.getX(), depth, pos.getY()))
obj.setScale(scale)
obj.setBin("unsorted", 0)
obj.setDepthTest(False)
obj.setP(rot)
if transparency: obj.setTransparency(1)
if tex:
tex = loader.loadTexture(tex+".png")
obj.setTexture(tex, 1)
return obj
def character(self):
self.loadObject("warrior",depth=11)
def map(self):
i=0
for x in gamemap:
if x==1 and i<5:
posx=(i-2)*3.0
posy=0
self.loadObject("ground", pos=Point2(posx,posy),scale=3,rot = -80,depth=12)
elif x==1 and i>=6 and i<11:
posx=i-7
posx=(posx-1.5)*3.0
posy=-0.6
self.loadObject("ground", pos=Point2(posx,posy),scale=3,rot = -80,depth=12)
elif x==1 and i>=12:
posx=i-13
posx=(posx-1.5)*3.0
posy=-1.2
self.loadObject("ground", pos=Point2(posx,posy),scale=3,rot = -80,depth=12)
i+=1
print i
def tree(self):
self.tree=self.loader.loadModel("dry_tree")
self.tree.reparentTo(self.render)
self.tree.setPos(0,2,2)
self.tree.setScale(3)
Load().run()
the problem:
the tree is not showing up
EDIT: found the problem, the tree was showing up, it was just too small to be seen