I have been researching this topic and I have found that it is quite a dicey topic
I have a cube and I need to read the current state of its rotation
I have read the article on quaternions by starmanta
https://starmanta.gitbooks.io/unitytipsredux/content/second-question.html
and so I have learned that the inspector cannot be relied upon for much, but i still dont understand it fully, so please bear with me
I have found that with this code I can measure the rotation on the Y axis:
Mathf.Atan2(transform.forward.x,transform.forward.z) * Mathf.Rad2Deg)
but I cant figure out how to measure for example the rotation on z after I have already rotated the cube by 90 degrees on Y
here is an image of my issue:
it seems that things seem to get dicey when I start compounding rotations, I guess that this is the general problem described on the starmanta article?
My goal is to find out, in some measureable human readable way, how much the cube is rotated, in other words, what face is currently facing the camera, and if its upside down, etc, I would need every detail of the current state of the rotation of the cube
since this cube is child of other objects which also rotate, its hard to manually keep track of the exact current rotation of the cube
I have the transform.rotation which is exactly what I need, the world quaternion of the cube, but thats not really human readable
I was looking for a way that I can output the exact WORLD rotation of the cube, in other words, to translate the quaternion in some sort of readable value
it doesnt matter to me if its a combination of values, and the format also doesnt really matter to me, it doesnt need to mirror the contents of the inspector, I just need some logical output of rotation that I can read and can then use then to create logic based on the state of the cube relative to the front facing camera.
Thanks!