Calculating the rotation of an object, when the top is forward

Hey everyone!


I’ve been struggling with this problem for a while, I think I can explain it better with pictures than my words.
So If I want to rotate the top to forward like this with no rotation already done:

It’s quite easy to figure out the rotation of the dice, It’s just -90 degrees to the Z rotation.
But when I try to do it with an already rotated dice thing happen, which i don’t know how work:

Can somebody help me understand how does this works, or how to calculate the rotation If I have the start rotation and for example I want to rotate it in the world’s X axis?


Thank you for your answers!

You can use transform.Rotate() and specify both axis and angle, as well as if you want to do it in local space or world space