Panda3d 带箭头的相机移动
Panda3d Movement of camera with arrows
我正在尝试使用带箭头的 panda3d 移动我的相机,但出现错误:
功能:
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)
您的函数未绑定到 class,因此不会有 self
。
我正在尝试使用带箭头的 panda3d 移动我的相机,但出现错误: 功能:
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)
您的函数未绑定到 class,因此不会有 self
。