Search Unity

How to get Euler rotation angles exactly as displayed in the Transform inspector?

Discussion in 'Editor & General Support' started by SuperUltraHyper, Aug 14, 2017.

  1. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    112
    How to get Euler rotation angles exactly as displayed in the Transform inspector?

    Sounds simple right. I have no idea. :(

    Code (CSharp):
    1. Debug.Log("T = " + transform.eulerAngles);
    It seems like this would have been answered before but I can't seem to find that either.

    Thanks for the help!
     
  2. nilsk123

    nilsk123

    Joined:
    Dec 13, 2016
    Posts:
    19
  3. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    112
    Yeah... Unfortunately, that doesn't address my question at all.

    For Example:

    Unity Editor ---> Transform ---> Rotation ---> (0,0,5)

    Unity Script ---> Debug.Log(m_sourceObject.eulerAngles); ---> (85,90,90)
     
    Last edited: Aug 15, 2017
  4. greg-harding

    greg-harding

    Joined:
    Apr 11, 2013
    Posts:
    524
    Yes it did. There are two sets of angles: eulerAngles and localEulerAngles.
     
  5. SuperUltraHyper

    SuperUltraHyper

    Joined:
    Sep 7, 2015
    Posts:
    112
    Whoops... Yeah... your right.
    Had the parenting backwards...