ShowBase window tends to reset its position when trying to grab it

I tried implementing a 3rd person camera for my application but it seems to produce some issues with the window properties. In the inherited class of ShowBase I add a task via self.taskMgr.add(self.OrbitCameraTask, 'thirdPersonCameraTask')

where OrbitCameraTask is:

def OrbitCameraTask(self,task):
        md =
        if base.mouseWatcherNode.isButtonDown(
            x = md.getX()
            y = md.getY()
            if, int(self.x_mouse_position), int(self.y_mouse_position)):
                self.heading = self.heading - (x - self.x_mouse_position) * 0.5
                self.pitch = self.pitch - (y - self.y_mouse_position) * 0.5
            if self.pitch > 90:
                self.pitch = 90
            elif self.pitch <-90:
                self.pitch = -90
            self.parentnode.setHpr(self.heading, self.pitch,0)
            self.x_mouse_position = md.getX()
            self.y_mouse_position = md.getY()
        return task.cont

When i dont bind the task, I can move the window without any problem, but adding the task resets the window to the original position, when i try to move it.

‘self.props’ is :

self.props = WindowProperties()
self.props.setOrigin(100, 100)
self.props.setSize(int(self.canvas_width), int(self.canvas_height))

I think this behaiviour comes from setting the window properties from self.props, right? What would be the right way to hide and show the cursor in this case?

Yeah. You are reseting windows location and size every time.
You need to request a single cursor visibility option only:

properties = WindowProperties()
#properties.set_cursor_hidden(False)  # request cursor option changes
1 Like