Hello, I’m new to panda3d and I’m trying to move an object with the keyboard, I don’t see any problem with my code compared to the examples, but it just won’t work. I get the following error:
self.accept( 'arrow_left' , x_minus )
AttributeError: MyApp instance has no attribute 'accept'
:task(error): Exception occurred in PythonTask eventManager
here is my code:
def x_plus():
cursor.setX(cursor.getX() + 0.1)
def x_minus():
cursor.setX(cursor.getX() - 0.1)
def y_plus():
cursor.setY(cursor.getY() + 0.1)
def y_minus():
cursor.setY(cursor.getY() - 0.1)
class MyApp():
def __init__(self):
# Load Models
cursor = loader.loadModel("app/models/cursor")
cursor.reparentTo(render)
# Set Position, Scale and Orientation
cursor.setScale(0.05)
cursor.setPos(0,0,1.15)
self.accept( 'arrow_left' , x_minus )
self.accept( 'arrow_right' , x_plus )
self.accept( 'arrow_up' , y_plus )
self.accept( 'arrow_down' , y_minus )
Thanks in advance for your help!