Prevent flyby camera flip over?

Hi, I’m new to jmonkeyengine

I looked into jme3 sample tutorial HelloCollision which enable first person view

When I tried to rotate the camera upwards it went all the way up until the camera flip over (world upside down).

I’m wondering how to prevent the camera upward camera rotation in a certain range of angle

Let’s say that I want to make a first person shooter, which enable the player to look up and down but, it would be

ridiculous if the player can view the world upside down

Thanks and sorry about my English