I am trying to move my camera using panda3d with arrows but I get an error: function:
W = KeyboardButton.ascii_key('w')
S = KeyboardButton.ascii_key('s')
def moveTask(self, task):
is_down = base.mouseWatcherNode.is_button_down
dt = globalClock.getDt()
if is_down(W):
self.camera.setX(self.camera, -20 * dt)
if is_down(S):
self.camera.setX(self.camera, +20 * dt)
return task.cont
and where i add task:
Traceback (most recent call last):
File "panda.py", line 67, in <module>
app.run()
File "/usr/share/panda3d/direct/showbase/ShowBase.py", line 3025, in run
self.taskMgr.run()
File "/usr/share/panda3d/direct/task/Task.py", line 517, in run
self.step()
File "/usr/share/panda3d/direct/task/Task.py", line 471, in step
self.mgr.poll()
TypeError: moveTask() takes exactly 2 arguments (1 given)
Your function isn't bound to a class, so there'll be no self
.