How can I limit the rotation of a Camera?

OS: ANDROID
EXAMPLE MAP: FLYING

I would like to limit the spaceship / player to only be able to turn in any direction a certain amount of degress.
FOR EXAMPLE: If the player tries to turn right-> , after about 70degrees I want the ship to stop turning and to
begin going straight. Now, if the player tries to turn <-left , from this point, they will be able to turn for 70degrees (bringing them back to the middle-ground) and then for 70degrees to the left again.

IN-GAME EXAMPLE:
The player controls a spaceship. The spaceship is in space, but there is a transparent outline or grid in the shape of a cylinder / tube that forces the player to keep moving in that direction. Hitting the mesh of the cylinder will make them slide against it in the same direction I initially forced them to fly in. But what I want to do is restrict them from continuing to turn left or right in order to avoid having them end up flying backwards (the wrong way).
They should be able to fly left and right to about 70degrees, in this example.

Thank you for your time!
I will upload any info / screenshots upon specific request.

Ok so I made a tutorial that covers the process from scratch.

Part1 - Setting the controls for Mobile Device

Part2 - Restricting the camera rotation

Part3 - Setting the Wall Collisions

Making a full tutorial from scratch for this. It’ll be up soon-ish today.

Updated my answer

SWEET!
That works flawlessly =)

One thing I forgot to mention was that I meant to use the touch joysticks
during gameplay… well at least the left one for now, I haven’t implemented anything particular on the right stick.

I did skip the majority of the first part but the second part was
exactly what I was looking for.
Honestly this video tut response thing is magical.

Very thorough, thank you.

haha no problem, I had fun with it :slight_smile: I also added a third part if you haven’t checked it out yet, might be useful to you. Sorry about the loud crashing sounds and the mouse cursor disappearing towards the end!I was thinking of making a few more but I think I’ll just keep working on my other projects.

If you need anything else feel free to ask. And remember to accept the answer for tracking purposes. Take care and keep up the good work!