Search Unity

Animation in Unity look different than in Blender - riggify addon

Discussion in 'Asset Importing & Exporting' started by Eleara, Dec 25, 2020.

  1. Eleara

    Eleara

    Joined:
    Dec 25, 2020
    Posts:
    11
    Hi,
    I am working on a school project and need to import this simple model and animation of a crane to Unity. It was made using a Riggify rig. In Blender the animation looks like this: https://imgur.com/a/APOse0S
    And in Unity it looks like this: https://imgur.com/a/OgPGWMH

    The difference is in how the left wing and the head are distorted in some parts of the animation. It happens when I export in .fbx and also when I import a .blend file to Unity.

    What can I do to fix this?
     
  2. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    What kind of Unity rig (avatar) is used? Is it Mecanim humanoid or Generic? I suspect that Rigify can throw off mecanim avatar generation by creating extra helper bones.If you use *.fbx export, it should have "Deform bones only" checkbox somewhere. Try it; in theory it should discard bones which do not have influences on the mesh, such as Rigify helpers.
     
  3. Eleara

    Eleara

    Joined:
    Dec 25, 2020
    Posts:
    11
    @DimitriX89 Thank you for your answer. I'm using Generic rig and when I exported to .fbx I checked the "Deform bones only" checkbox.
     
  4. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    Then it could be something in the rig that doesnt translate to Blender. Do you know what constraints are used in the wing?
     
  5. Eleara

    Eleara

    Joined:
    Dec 25, 2020
    Posts:
    11
    I don't know, sorry, i"m a noob. :D
    How do I check that?
     
  6. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
  7. Eleara

    Eleara

    Joined:
    Dec 25, 2020
    Posts:
    11
    upload_2020-12-26_22-5-26.png
    I'm not sure what to look for. Can i upload the .blend file here?
     
  8. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    Here- most likely no. Maybe using 3rd party file hosting and a link?
    But I see what I asked about. The constraint is Copy Transforms; it shouldnt be problematic but I cant be 100% sure. You can also try Pose - Animation - Bake Action (Visual Keying should be enabled) to bake animation before export. *.FBX exporter should bake constraints to keyframes by default, but who knows if it does it wrong.
     
  9. Eleara

    Eleara

    Joined:
    Dec 25, 2020
    Posts:
    11
    I tried baking, but should I bake having only the rig selected, or the mesh as well?
     
  10. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    Ideally-your deform bones only. And save a backup file; since it might be better to select Clear Constraints when baking
     
  11. Eleara

    Eleara

    Joined:
    Dec 25, 2020
    Posts:
    11
    So when I bake the animation in Blender like you said, it looks deformed in the same way as in Unity. What can cause this?
     
  12. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    It looks like bone is being scaled during animation, while it shouldnt. You can check if the baked animation has any Scale keyframes (Scale on the Transform panel) at these frame times
     
  13. Eleara

    Eleara

    Joined:
    Dec 25, 2020
    Posts:
    11
    It looks like it happens in these Action frames, but I don't know how to impact them. It starts after frame 43 and all location frames, scale frames etc stop earlier than that. What should I do?
    upload_2020-12-27_21-21-44.png
     
  14. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
  15. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    Well, you can delete scaling information from bones in Pose mode as shown on screenshot. You definitely have some non-uniform scaling going on.
     
  16. Eleara

    Eleara

    Joined:
    Dec 25, 2020
    Posts:
    11
    But I don't seem to be able to delete these specific keyframes that are in the "Action" part. I want to delete keyframes from frame 45 to 145 and I can't, when I try to delete them nothing happens. And they seem to be the problem in the wing.
     
  17. Eleara

    Eleara

    Joined:
    Dec 25, 2020
    Posts:
    11
  18. DimitriX89

    DimitriX89

    Joined:
    Jun 3, 2015
    Posts:
    551
    I meant, when the bone is selected in Pose mode, you can right click its Scale component in Transform window and select Delete Keyframes. This will clear all the scale animation while leaving other data intact
     
  19. Eleara

    Eleara

    Joined:
    Dec 25, 2020
    Posts:
    11
    Ok, it somehow finally works! Thank you so much for your help.