VERY quick question (What is setH/setP?) (Solved)

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.

HPR stands for Heading, Pitch, and Roll. You can set or get all three at once with setHpr()/getHpr(), or you can set or get the individual components with setH()/getH(), setP()/getP(), and setR()/getR().

A similar overall vs. componentwise interface exists for setPos()/getPos() vs. setX, setY, and setZ.

By fiddling with setP and setH, the code is attempting to rotate the camera vertically and horizontally.

David

Thank you so much, such a simple thing but baffling if you simply weren’t aware of it, lol!

Note that this is also explained at this manual page:
panda3d.org/manual/index.php/Common_State_Changes
That page also lists other useful functions.