There are no errors in this code but when I run the code, the camera is fine, I can look around and all of that. As soon as I move, it starts rotating around the origin of it's spawn.
Camera code: http://hatebin.com/iiceqotcpu
Main code mouse_callback
def mouse_callback(window, xpos, ypos):
global first_mouse,lastX, lastY
if first_mouse:
lastX = xpos
lastY = ypos
first_mouse = False
xoffset = xpos - lastX
yoffset = lastY - ypos
lastX = xpos
lastY = ypos
cam.process_mouse_movement(xoffset, yoffset)
The translational part of the view matrix should come before the rotational part, since you must apply the rotation to the relative position of the point.
# before
return translation * rotation
# after
return rotation * translation