Hello, i am really new at coding with panda3d so forgive me if i am coding wrong. I have been having this problem when trying to make a model move when the W key is pressed. I have the following code:
from direct.showbase.ShowBase import ShowBase
from direct.showbase.DirectObject import DirectObjectclass Game(ShowBase):
def __init__(self):
ShowBase.__init__(self)self.scene = self.loader.loadModel("models/environment") self.scene.reparentTo(self.render) self.scene.setScale(0.25, 0.25, 0.25) self.scene.setPos(0, 0, 0) self.panda = self.loader.loadModel("models/panda") self.panda.reparentTo(self.render) self.panda.setScale(0.5, 0.5, 0.5) self.panda.setPos(5, 5, 10)
class Movement(DirectObject):
def __init__(self):
self.accept(āwā, self.Move)
self.accept(āw-repeatā, self.Move)
self.accept(āw-upā, self.Move)def Move(self): print('pressed w')
app = Game()
app.run()
I donāt have a function for moving currently added, but when i press w or hold it, it doesnāt print āpressed wā. I have been following the code from the keyboard support tutorial.
The console shows no errors, and iām on the latest version as of now.
Any help and/or ideas to make it work and for me to be able to move the āpanda modelā? Everything else is working, i can see the models and i can move the camera around.