Hi I am trying to make a game on panda3d v 1.8.1 (python) but the controls seem to be very sloppy. One has to keep the keys pressed for a second or two to make things happen. Is there any way to make panda3d accept controls faster ?
Here's my code of my key handler :
class KeyHandler(DirectObject):
def __init__(self):
self.accept('arrow_left-repeat', self.lookLeft)
self.accept('arrow_right-repeat', self.lookRight)
self.accept('arrow_up-repeat', self.lookUp)
self.accept('arrow_down-repeat', self.lookDown)
self.accept('w-repeat', self.Moveforward)
self.accept('s-repeat', self.Movebackward)
self.accept('a-repeat', self.Moveleft)
self.accept('d-repeat', self.Moveright)
self.accept('q-repeat', self.MoveDown)
self.accept('e-repeat', self.MoveUp)
self.accept('space', self.Dotask)
def lookLeft(self):
global camxy
camxy += 2
def lookRight(self):
global camxy
camxy -= 2
def lookUp(self):
global camyz
camyz += 2
def lookDown(self):
global camyz
camyz -= 2
def Moveforward(self):
global camx
if camx < 57 :
camx += 1
def Movebackward(self):
global camx
if camx > -32 :
camx -= 1
def Moveleft(self):
global camy
if camy < 42 :
camy += 1
def Moveright(self):
global camy
if camy > -36 :
camy -= 1
def MoveUp(self):
global camz
if camz < 15 :
camz += 0.5
def MoveDown(self):
global camz
if camz >1 :
camz -= 0.5
a = KeyHandler()
def set_cam(task) :
camera.setPos(camx,camy,camz)
camera.setHpr(camxy,camyz,camzx)
taskMgr.add(set_cam, "setcamTask")
The camera which I am using is the default camera of panda3d.
Any help would be appreciated !