forgive my poor English, use google translator
someone could help me that is wrong in this code can not move the camera
to run it gives me the following:
File “movcam.py”, line 37, in
Game()
File “movcam.py”, line 20, in init
self.accept (“arrow_right”, self.spinCamera,[1])
AttributeError: Game instance has no attribute ‘spinCamera’
**** End of process output ****
The code
import sys
import direct.directbase.DirectStart
from direct.actor import Actor
from direct.showbase import DirectObject
class Game(DirectObject.DirectObject):
angle = 0
distance = 0
def __init__(self):
self.panda =loader.loadModel("models/panda")
self.panda.reparentTo(render)
self.panda.setPos(0, 1000,-100)
self.panda.setScale(0.5, 0.5,0.5)
self.accept("escape",sys.exit )
self.accept ("arrow_right", self.spinCamera,[1])
self.accept("arrow_left",self.spinCamera,[-1])
self.accept("arrow_down",self.zoomCamera,[1])
self.accept("arrow_up",self.zoomCamera,[-1])
base.disableMouse()
base.camLens.setFar(10000)
def spinCamera (self,direction):
self.angle += direction * 1.0
base.camera.setHpr(self.angle, 0, 0)
def zoomCamera(self,direction):
self.distance += direction *10.0
base.camera.setPos(0,self.distance, 0)
Game()
run()
thanks