[docs]defupdate_camera_vectors(self):""" We emulate a first-person camera by rotating around the Z-axis and X-axis """yaw=glm.radians(self.yaw)pitch=glm.radians(self.pitch)self.forward.x=glm.cos(yaw)*glm.cos(pitch)self.forward.y=glm.sin(pitch)self.forward.z=glm.sin(yaw)*glm.cos(pitch)self.forward=glm.normalize(self.forward)self.right=glm.normalize(glm.cross(self.forward,glm.vec3(0,1,0)))self.up=glm.normalize(glm.cross(self.right,self.forward))
[docs]defupdate(self):self.move()self.rotate()self.update_camera_vectors()# Re-calculate the view matrixself.m_view=self.get_view_matrix()