Resident Evil 4 Style Aiming Window - Rotational Problem When Aiming

I am trying to create a Resident Evil 4 - Style “Aimbox window”. I have made a lot of progress to my the current build of my game – However my solution for Aiming my gun within bounds isn’t working.

I want to move the gun independently of the body when in aiming mode, however, when I move the gun out of bounds (degrees based on the relative position fo the player) I want the entire body to move with the gun synchronously.

My current solution is overly complex. It is not usually my style to ask for help, but I really could use some. The game works with regular rotation, however, i really have my mind set on this feature.

Wow. fixed it in 3 lines and deleted some janky inefficient code:

            gun.transform.rotation = Quaternion.Euler(-rotationX, rotationY, 0);

            // If you move the lasersight out of bounds
            if (angleDiff > 50f)
            {
                playerBodyPivotAim.transform.rotation = Quaternion.Lerp(playerBodyPivotAim.transform.rotation, gun.transform.rotation, bodyAimFollow);
            }