Search Unity

Why unity messing up with bones transformations?

Discussion in 'Formats & External Tools' started by StepanKoppel, Jul 1, 2017.

  1. StepanKoppel

    StepanKoppel

    Joined:
    Mar 4, 2015
    Posts:
    5
    I have model which exported from blender(via fbx). In blender this bone has complete zero orientations and bone roll is set to match unity coordinate system, also export was correct (Y-UP, Z- Forward)...I mean, export is correct, but in unity my bone has X rotation of 12 (it must not have any rotations) and when I am trying to manipulate rotation in inspector I get weird rotation while transform manipulators can rotate everything correctly (see gif animation)



    copy from: https://forum.unity3d.com/threads/why-unity-messing-up-with-bones-transformations.480996/
    because i don't know Is there a problem with blender or unity
     
    Last edited: Jul 1, 2017
  2. Cygon4

    Cygon4

    Joined:
    Sep 17, 2012
    Posts:
    382
    First thing to check: Do you have any animation tracks you're exporting together with the model/rig?

    The neutral pose often becomes the initial pose of one of the animation clip (actions) in the .fbx file. A useful workaround is to only export the master model with a single animation clip showing it in its bind pose and putting all animation clips you actually want to export into a separate .blend file (that uses Blender's library linking feature to reference the master model).

    Second thing to check: Are all your bones actually in their bind pose when exporting?

    Enter pose mode in blender, select all bones, hit Alt+G, Alt+R, Alt+S to reset translation, rotation and scale of all bones to their bind pose. Nothing should move.
     
  3. StepanKoppel

    StepanKoppel

    Joined:
    Mar 4, 2015
    Posts:
    5
    Well...
    I dont have any animations
    And my bone poses are the same in pose mode and edit mode (in bind)
     
    Last edited: Jul 4, 2017
  4. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    Blender uses its own "genius" approach to bone rotation: instead of X-axis matching direction along the bone, it is Y-axis
    https://gyazo.com/af7b71cb8df20bdec12b4f0d4d2d6075
    (an example of skeleton set up in Blender to match 3ds Max bone rotations; if the bone had zero rotation in Max, in Blender it translates into bone pointing towards Y-positive)
    So exporting programs have to compensate for this mess with added rotations
     
  5. StepanKoppel

    StepanKoppel

    Joined:
    Mar 4, 2015
    Posts:
    5
    It is OpenGL and directX problems (blender has nothing to do with it, example: normal map green channel rotation)
    But my problem is in unity, why Unity rotates bones in such a strange way? Once model is loaded in scene it is no longer fbx or anything so that is why I am asking: why unity do this? Is this a bug or what?
     
  6. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    I am pretty sure OpenGL and DirectX shouldnt have to do anything with the way rotation coordinates are handled, since they are just different instructions used to visualise same 3d data. For example in 3ds max you can change D3D to OpenGL rendering any time and it wont do anything with the way rotations are handled. No this is definitely a quirk of Blender skeleton (Armature) system. If you export the non-bone based object hierarchy from Blender (like, whole scene into FBX where some objects are parented to eachother) the rotations in Unity will be exactly how they were in Blender (with consideration of Z to Y swap of course).
     
    Last edited: Jul 6, 2017
  7. AndreiKubyshkin

    AndreiKubyshkin

    Joined:
    Nov 14, 2013
    Posts:
    213
    is the wheel_front_R object a child of another object? if yes, the rotation x y z fields in the inspector represent the local rotations of the object in the space of it's parent. While transform gizmo axis represent the object space. The problem can be reproduced in any 3d software, this is not a bug