Try printing out the angles to the screen while the game is running. I’m particularly suspicious of your pitch angle. I think it may be going past -180 and hitting +180, and thus causing the problem here.
Try printing out the angles to the screen while the game is running. I’m particularly suspicious of your pitch angle. I think it may be going past -180 and hitting +180, and thus causing the problem here.