Can't rotate kinematic character controller properly

olihunt
Posts: 1
Joined: Thu Apr 19, 2012 11:12 pm

Can't rotate kinematic character controller properly

Post by olihunt »

Code: Select all

            def mouse(self,task):
                    md = base.win.getPointer(0)
                    x = md.getX()
                    y = md.getY()
                    print base.camera.getP()
                    print self.playerNP.getH()
                    if base.win.movePointer(0, base.win.getXSize()/2, base.win.getYSize()/2):
                            self.playerNP.setH(self.playerNP.getH() -  (x - base.win.getXSize()/2)*0.1)
                            base.camera.setP(base.camera.getP() - (y - base.win.getYSize()/2)*0.1)
                    return task.cont
This python code is meant to rotate the character controller left and right when the mouse moves left and right, and rotate the camera that is attached to it up and down when the mouse moves up and down, to give a first person view / control. The camera moves fine with the mouse. The controller seems to jump to completely random values of H when I move the mouse along the x axis. How do I fix this, or is this a bug? I am using Panda3d with Bullet.