After following an fps controller tutorial on youtube, the character can now walk in all directions and jump and also look in all directions. But my head would somehow turn downwards until my entire camera spins an entire circle! There is a piece of code that I think could fix this issue, but it doesn't seem to work. The piece of code is:
head.rotation.x = clamp(head.rotation.x, deg2rad(-90), deg2rad(90)). I don't think there is a problem with this code.