Search Unity

Blender animation rotation issue

Discussion in 'Asset Importing & Exporting' started by athert, Dec 21, 2020.

  1. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    36
    I know this looks like typical issue with left/right hand rotations but let me explain this weird behavior.
    I have two different models in separated .blend files (male/female). Both models are rotated same way (-180°, forward Y), both use somehow same armature (there are differences but not at base) and they are exported with same export preset.
    Problem is that male is working pretty much perfectly. Its rotated correctly, root motion is working as expected.
    On other hand female is not working at all. It looks like she is rotated by another 90° even if everything on both files seems same.
    I tried different Unity version, different Blender version, i tried to import both .fbx into 3Ds max to see if there is issue in them but exports looks correct too (they overlap perfectly). It looks like that there is "something" in female model that is corrupting her rotation when importing to Unity.
    Month ago i find out that when model doesnt have normalized weights, unity will normalize it itself and that can cause some visual glitches so i think this is something similar where in blender everything looks fine but unity will try to "fix" it.
    Can you please tell me if there is anyone who already found solution to this?
    Also as i promised, there is few images

    [Female in blender, looking at Y]
    upload_2020-12-21_23-36-8.png
    [Male in blender, also looking at Y]
    upload_2020-12-21_23-36-38.png
    [Female in Unity, rotated by 90° sideways]
    upload_2020-12-21_23-38-24.png
    [Male in Unity, rotated correctly]
    upload_2020-12-21_23-40-20.png

    Both have same armature/model rotation and position. Both have same bones positions in animation. Both have correctly set root node in Unity.
     
  2. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    Is the problem the same without animation? Because if it is animation only, in some situations Mecanim gives the model wrong rotation based on avatar skeleton bones' orientation at a start keyframe. Setting Root Transform Rotation - Based Upon to "Original" (in animation import tab) might fix the problem. https://docs.unity3d.com/Manual/class-AnimationClip.html
     
  3. athert

    athert

    Joined:
    Dec 31, 2012
    Posts:
    36
    unfortunately its affecting model and rotation in animations (so even without animation). Model can be rotated, thats not big deal but animations are rotated itself by 90°
    I tried root - original as you mentioned and it rotated characters by another 90° but incorrectly (so they are now 180° instead of 90°). Other animations, for example sitting on bench are not affected by this setting for some reason.
    I tried for test to set root motion node even if i have same root node set in "rig" on these animations and they started working as intended even if this settings doesnt work on male character at all.
    I can of course offset animations but i dont want becouse it seems like bug in asset and that should not be "fixed" by rotation all animations by 180° in unity
     
  4. Siccity

    Siccity

    Joined:
    Dec 7, 2013
    Posts:
    255
    FBX and blender do not work together well. That's why you're having those rotation issues. My solution to this problem was using glTF instead of FBX. Unfortunately Unity does not support glTF natively so you have to use plugins. I don't know if using another format is an option for you, but if it is, I recommend checking out my plugin GLTFUtility. Using this format, models exported from blender should have the correct orientation in Unity, always.