我试图使用带箭头的panda3d移动我的相机,但得到一个错误: 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和我添加任务的地方:
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)发布于 2017-02-24 20:58:23
您的函数没有绑定到类,因此不会有self。
https://stackoverflow.com/questions/42072376
复制相似问题