How to disable automatic camera rotation when touching rotating objects?

When standing on, eg. a cube that spins, the character automatically rotates with it, as expected. However, the camera also rotates, which is far from desired. I’d like to still be able to look in the direction I’m looking when standing on something. The issue becomes huge when you have small physical objects, as every time you walk over them, they flip and the camera spins around.