The easiest way is to create a pivot - the player controls the pivot via mouse.
Create a camera, parent it to the pivot. Apply your rocking code to the camera, not the pivot.
Create a camera, parent it to the pivot. Apply your rocking code to the camera, not the pivot.