Using an event handler to rotate the camera and stay rotated

I’m trying to use an event handler that will rotate the camera and then have the camera stay in that rotation afterward. So far I have:

camDegrees = 0
def myFunction():
camRadians = camDegrees * (pi / 180.0)
p3dApp.camera.setPos(20 * sin(camRadians), -20.0 * cos(camRadians), 3)
base.camera.setH(base.camera,camDegrees)
return camDegrees+1

base.buttonThrowers[0].node().setButtonDownEvent(‘button’)

base.accept(‘w’, myFunction)

I got this from a site online. I’m not using classes mostly because I find it awkward to use classes to do things, so I’d prefer to keep classes out of the code, but if necessary that’s fine.

The above code rotates the camera, but it immediately returns to the default position. I thought maybe this had to do with base.disableMouse(), but I added that to my code and it’s still not working.

Oh, apparently base.disableMouse() has to go inside the function the event handler calls. I now have it working. :smiley: