I was at a loss trying to go solely on the documentation to implement a mouselook in my FPSMMORPG that I’m making. Anywho, I looked about and found tree’s FPS script here:
discourse.panda3d.org/viewtopic.php?t=4068
I am trying to understand and implement a similar situation, so firstly I tried using his code in a task on my game. It snaps the mouse to the center of the screen, letting it move enough to capture data, but the screen doesnt move about (if it does, it is sporatic and stuck in a direction). Anyway, to troubleshoot I need to understand the code.
Here’s what’s on my task:
def mouselook(self,task):
#Get Mouse X & Y
x=self.mouse.getX()
y=self.mouse.getY()
#Move Screen based on Mouse X & Y
if base.win.movePointer(0, base.win.getXSize()/2,base.win.getYSize()/2):
self.actor.setH(self.actor.getH()-(x-base.win.getXSize()/2)*.1)
base.camera.setP(base.camera.getP()-(y-base.win.getYSize()/2)*0.1)
return Task.cont
I need to know two things: What is setH/getH, and what is setP/getP? I was unable to find documentation on these functions. What I assume is that they are undocumented abbreviations for something like Hpr and Pos, but I am only guessing. If anyone could answer me that and/or tell me why this code doesn’t work, It’d be much appreciated.