problem with rotating code

Is there any way to make it rotate only 10 degrees?
The models are the ones that come with Danda3D.

from direct.showbase.DirectObject import DirectObject
import direct.directbase.DirectStart
from panda3d.core import Camera,PandaNode,NodePath
from direct.showbase.ShowBase import ShowBase
from direct.actor.Actor import Actor
from direct.task import Task
import math
import sys
class GameEngine(DirectObject):
	def __init__(self):
		self.keyMap = {"left":0, "right":0, "up":0, "down":0}
		
		self.environ = loader.loadModel("models/environment")      
		self.environ.reparentTo(render)
		self.environ.setPos(0,0,0)
		self.player = Actor("models/ralph",{"run":"models/ralph-run","walk":"models/ralph-walk"})
		self.player.reparentTo(render)
		self.player.setPos(0,0,0)
		self.player.setH(0)
		base.cam.setPos(-30,0,0)
		#base.cam.setH(0)
		taskMgr.add(self.cameracontrol, "cameracontrol")
		
		self.floater = NodePath(PandaNode("floater"))
		self.floater.reparentTo(render)
		
		self.accept("escape", sys.exit)
		self.accept("arrow_left", self.setKey, ["left",1])
		self.accept("arrow_right", self.setKey, ["right",1])
		self.accept("arrow_up", self.setKey, ["up",1])
		self.accept("arrow_down", self.setKey, ["down",1])		
		

	def setKey(self, key, value):
		self.keyMap[key] = value
		
	def cameracontrol(self, task):
		self.floater.setPos(self.player.getPos())
		self.floater.setZ(self.floater.getZ()+3)
		base.cam.lookAt(self.floater)
		hbase=30
		heading = base.cam.getH()
		#base.cam.setH(0)
		x = base.cam.getX()
		y = base.cam.getY()
		z = 10
		if (self.keyMap["left"]!=0):
			base.cam.setH(base.cam.getH()+1)
			heading = base.cam.getH()
			x = -hbase*math.cos((heading*(math.pi/180)))
			y = -hbase*math.sin((heading*(math.pi/180)))
		if (self.keyMap["right"]!=0):
			base.cam.setH(base.cam.getH()-1)
			heading = base.cam.getH()	
			x = hbase*math.cos((heading*(math.pi/180)))
			y = hbase*math.sin((heading*(math.pi/180)))
		base.cam.setPos(x,y,z)
		
		self.setKey("right",0)
		self.setKey("left",0)
		return Task.cont
	

Game=GameEngine()
run()

make what rotate only 10 degrees…?

The purpose of this code is to allow the user to use the arrow keys (left and right at the moment)to move the camera around the player but remain a fixed distance away. However when i run this code it rotates about 90 degrees.

Looks like your code is trying to rotate by 1 degree: base.cam.setH(base.cam.getH()+1)
then you use the new heading in your sin and cos.

The way it is set up with the camera at (-30,0,0) and Player at (0,0,0), after doing lookAt your get a heading of 90 deg, then you are basiclly calculating a new camera position using 90 + or - 1. Well, lets just say it’s 90 deg and you’ll see when you plug it in…
z = 10
x = -30math.cos((90(math.pi/180)))
y = -30math.sin((90(math.pi/180)))

x = 0, y = -30

so after the first press of arrow key you get

cam.setPos(0,-30,10) which is like a 90 deg rotation from your previous position.

try setting your initial camera position to (0.,-30,.0.)