【问题标题】:Panda3d Movement of camera with arrowsPanda3d 带箭头的相机运动
【发布时间】:2017-02-06 16:15:15
【问题描述】:

我正在尝试使用带有箭头的 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)

【问题讨论】:

    标签: python task panda3d


    【解决方案1】:

    你的函数没有绑定到一个类,所以不会有self

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 2014-03-11
      • 1970-01-01
      • 2018-08-26
      • 1970-01-01
      • 2012-01-20
      • 2018-01-16
      • 1970-01-01
      相关资源
      最近更新 更多