Search Unity

  1. We are migrating the Unity Forums to Unity Discussions by the end of July. Read our announcement for more information and let us know if you have any questions.
    Dismiss Notice
  2. Dismiss Notice

Tait-Bryan (Euler) rotations

Discussion in 'Scripting' started by tibor02, Aug 3, 2022.

  1. tibor02

    tibor02

    Joined:
    Aug 3, 2022
    Posts:
    4
    I have been experimenting with Quaternion.Euler() and transform.rotation.eulerAngles. I could not find much information but I think that the two statements use Tait-Bryan (as opposed to Proper) Euler angles with a z-x-y rotations in extrinsic mode.
    I did some tests in Unity 3D and I think this is correct but I would like somebody to confirm please :).

    The documentation for Euler() method says "Returns a rotation that rotates z degrees around the z axis, x degrees around the x axis, and y degrees around the y axis; applied in that order." so I assumed z-x-y.
     
  2. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,434
  3. tibor02

    tibor02

    Joined:
    Aug 3, 2022
    Posts:
    4
  4. Kurt-Dekker

    Kurt-Dekker

    Joined:
    Mar 16, 2013
    Posts:
    39,434
    Works fine for me. Try incognito window.
     
  5. tibor02

    tibor02

    Joined:
    Aug 3, 2022
    Posts:
    4
    The link works fine now, thank you for the suggestion.
    Though, the link only mentions the associated problems with Euler angles and why it is better to use quaternions, it does not answer the thread question, that is if the Unity wrapper methods like Euler() are using Tait-Baylor z-x-y conversion?
     
  6. Bunny83

    Bunny83

    Joined:
    Oct 18, 2010
    Posts:
    4,219
    Yes, it does. I don't think I've ever seen any application that uses "proper euler angles". The Tait–Bryan "flavour" is pretty much the standard in aviation, engineering and pretty much any other field I can think of. Proper euler angles are horrible to convert between extrinsic and intrinsic while the Tait–Bryan euler angles just use the reverse order.

    So yes, you would rotate first around the world/parent z axis, followed by the world/parent x axis, followed by the world/parent y axis.

    You can view them as intrinsic by rotating by the local y axis first, followed by the new local x axis, followed by the new local z axis. Both represent the same thing
     
    tibor02 likes this.
  7. tibor02

    tibor02

    Joined:
    Aug 3, 2022
    Posts:
    4
    Thank you :)

    For an interested reader, this is the same how Unity 3D UI in Edit mode behaves. Applying rotation in Transform component to XYZ will rotate the object by z-x-y.

    More information about this can be found at the following Davenport rotation link on Wikipedia.
    As it is written the rotations are usually applied in yaw, pitch and roll order (z-y-x rotation) or M = Rz*Ry*Rx in matrix notation from the same link.
     
    Last edited: Aug 3, 2022