|
I do a debug.log(transform.rotation.y) and it returns me a value of 0-1. How can I get the real rotation in degrees and not a normalized value? Thanks
(comments are locked)
|
|
just type this: debug.log(transform.eulerAngles.y); more info on: http://unity3d.com/support/documentation/ScriptReference/Transform-eulerAngles.html
(comments are locked)
|

The rotations are Quaternions (a complex 4-dimentional representation of a rotation):
http://en.wikipedia.org/wiki/Quaternion
They have been invented to circumvent problems at certain angle-combinations. The 4 components of a quaternion have nothing to do with angles. Like iggy said you want the eulerAngles of the quaternion. The localEulerAngles are what you see in the inspector.
Ironically, the "complex 4-dimentional representation of a rotation" is normalized, so the op was right! :p
@Joshua: sure, but i just explained what you have to expect from the x,y,z,w components. If you don't want to do some lowlevel calculations on them you normally don't need to access the components of a quaternion.
The point is eulerAngles represents 3 rotations that are executed in order z,x,y (or reverse depends on local/global) The point is that some angles like x==90 or -90 a the y and z rotation affect the same axis, therefore you have unlimited possibilities to represent the rotation. It's getting worse when you want to do a relative rotation. That's why Quaternions are awesome. You can do relative rotations from an arbitrary rotation to another arbitrary rotation.
I know ^.^ I was just jokingly pointing out that they are indeed normalized. Anyway - to the OP: Don't touch them unless you understand them, and don't try to understand them unless you have at least an afternoon to waste. ;)