How to snap camera in 90 degree increments around my player object, on the X Axis?

My overall goal is to get the camera to rotate via click and drag, BUT only snap to the 90 degree positions on the x axis. Aka: never reach any other angles besides being directly facing center of the character, BUT still being able to pan above and below the player like a seesaw, and still able to scroll the mouse wheel to zoom in and out. My official final goal is to get this happening, but also internally spin the W,A,S,D movement, to where the controls also work as you would think when the camera snaps into place.

Say the player is facing forward, you would walk forward with “W”, then clicking and dragging the camera to the right, would have the player still facing the same direction, though visually facing the right side of the screen, and pressing the “D” key to walk forward now, and so on. Basically the WASD movement being bound to the cameras facing direction, rather than the players.

Sorry if you need ask any more questions please do

Mockup: Imgur: The magic of the Internet

consider this…

var forward = camera.transform.forward;
forward.y = 0;

characterController.SimpleMove(forward.normalized * speed);

Using the camera to get your directions is how you achieve the second part of your request.