How to make an actor rotate to a degree?

Hi everyone. I am making a game where the player can turn gravity on and off. When gravity is off, the player can spin upside down and rotate in any axis. When the player turns gravity on, I want the character to move upright before landing on the ground. How do I make it do that?

Basically, I want to set the actor’s Y and X to 0. And I what it to rotate, not “teleport” into the position.

Thank You!!!