camera.py
def update(self, task):
        """
        Task to update camera's position and rotation based on inputs.
        """
        dt = globalClock.getDt()

        # Getting mouse position
        md = self._showbase.win.getPointer(0)
	 
        x = md.getX()
        y = md.getY()
        center_x = self._showbase.win.getXSize() // 2
        center_y = self._showbase.win.getYSize() // 2
        
        if self._showbase.win.movePointer(0, center_x, center_y):
            self._heading = self._heading - (x - center_x) * self._mouse_sensivity
            self._pitch = self._pitch - (y - center_y) * self._mouse_sensivity
        
        # Set camera rotation based on mouse position
        self._showbase.camera.setHpr(self._heading, self._pitch, 0)

        pos_increment = dt * self._velocity * 60.0

        # Setting camera position based on inputs        
        if  self._input_state.isSet('forward'):
            self._showbase.camera.setY(self._showbase.camera, pos_increment)

        if  self._input_state.isSet('backward'):
            self._showbase.camera.setY(self._showbase.camera, -pos_increment)

        if  self._input_state.isSet('left'):
            self._showbase.camera.setX(self._showbase.camera, -pos_increment)

        if  self._input_state.isSet('right'):
            self._showbase.camera.setX(self._showbase.camera, pos_increment)

        if  self._input_state.isSet('up'):
            self._showbase.camera.setZ(self._showbase.camera, pos_increment)

        if  self._input_state.isSet('down'):
            self._showbase.camera.setZ(self._showbase.camera, -pos_increment)        
    
        return Task.cont

        Task to update camera's position and rotation based on inputs.
        
Task to update camera's position and rotation based on inputs.
Task to update camera ' s position and rotation based on inputs .
def update(self, task):
        dt = globalClock.getDt()
        md = self._showbase.win.getPointer(0)
        x = md.getX()
        y = md.getY()
        center_x = self._showbase.win.getXSize() // 2
        center_y = self._showbase.win.getYSize() // 2
        if self._showbase.win.movePointer(0, center_x, center_y):
            self._heading = self._heading - (x - center_x) * self._mouse_sensivity
            self._pitch = self._pitch - (y - center_y) * self._mouse_sensivity
        self._showbase.camera.setHpr(self._heading, self._pitch, 0)
        pos_increment = dt * self._velocity * 60.0
        if  self._input_state.isSet('forward'):
            self._showbase.camera.setY(self._showbase.camera, pos_increment)
        if  self._input_state.isSet('backward'):
            self._showbase.camera.setY(self._showbase.camera, -pos_increment)
        if  self._input_state.isSet('left'):
            self._showbase.camera.setX(self._showbase.camera, -pos_increment)
        if  self._input_state.isSet('right'):
            self._showbase.camera.setX(self._showbase.camera, pos_increment)
        if  self._input_state.isSet('up'):
            self._showbase.camera.setZ(self._showbase.camera, pos_increment)
        if  self._input_state.isSet('down'):
            self._showbase.camera.setZ(self._showbase.camera, -pos_increment)        
        return Task.cont
def update ( self , task ) : dt = globalClock . getDt ( ) md = self . _showbase . win . getPointer ( 0 ) x = md . getX ( ) y = md . getY ( ) center_x = self . _showbase . win . getXSize ( ) // 2 center_y = self . _showbase . win . getYSize ( ) // 2 if self . _showbase . win . movePointer ( 0 , center_x , center_y ) : self . _heading = self . _heading - ( x - center_x ) * self . _mouse_sensivity self . _pitch = self . _pitch - ( y - center_y ) * self . _mouse_sensivity self . _showbase . camera . setHpr ( self . _heading , self . _pitch , 0 ) pos_increment = dt * self . _velocity * 60.0 if self . _input_state . isSet ( 'forward' ) : self . _showbase . camera . setY ( self . _showbase . camera , pos_increment ) if self . _input_state . isSet ( 'backward' ) : self . _showbase . camera . setY ( self . _showbase . camera , - pos_increment ) if self . _input_state . isSet ( 'left' ) : self . _showbase . camera . setX ( self . _showbase . camera , - pos_increment ) if self . _input_state . isSet ( 'right' ) : self . _showbase . camera . setX ( self . _showbase . camera , pos_increment ) if self . _input_state . isSet ( 'up' ) : self . _showbase . camera . setZ ( self . _showbase . camera , pos_increment ) if self . _input_state . isSet ( 'down' ) : self . _showbase . camera . setZ ( self . _showbase . camera , - pos_increment ) return Task . cont
Task to update camera's position and rotation based on inputs.
Task to update camera ' s position and rotation based on inputs .
"""
        Task to update camera's position and rotation based on inputs.
        """ # Getting mouse position
 # Set camera rotation based on mouse position
 # Setting camera position based on inputs        

self
task