Hi.
I’ve got an issue with the Controlling the Camera tutorial: I’ve wrote the following code:
import direct.directbase.DirectStart
from direct.task import Task
from direct.actor import Actor
from direct.showbase import base
import math
#Carguemos algo
environ = loader.loadModel("models/environment")
environ.reparentTo(render)
environ.setScale(0.25,0.25,0.25)
environ.setPos(-8,42,0)
#Controlemos la cámara
def SpinCameraTask(task):
angledegrees = task.time * 6.0
angleradians = angledegrees * (math.pi / 180.0)
base.Camera.SetPos(20*math.sin(angleradians),-20.0*math.cos(angleradians),3)
base.Camera.SetHPR(angledegrees, 0, 0)
return task.cont
taskMgr.add(SpinCameraTask, "SpinCameraTask")
#Ahora a ejecutarlo
run()
And I’ve got this error after the program tried to run:
“AttributeError: ShowBase instance has no attribute ‘Camera’”
Could someone tell me what’s wrong with this code?