Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Fix for animation bug

Discussion in 'Editor & General Support' started by Babaa, Mar 27, 2010.

  1. Babaa

    Babaa

    Joined:
    Nov 24, 2009
    Posts:
    47
    Hi everyone,
    I've been working with Unity3d for a while now and I've encountered a seemingly random problem on different occations.

    My .fbx files containing rig+animation hasn't been working with my models, while in other cases everything has been working just fine.

    I've searched the forums, google and any other places I could think of for help but none of the solutions presented have worked for me.
    Today, however, I managed to find a solution to my problems and since I've seen many questions about this particular problem I thought I'd help out by posting here.

    The problem:
    You have a .fbx file containing a skinned mesh and its rig (without animations) and one or more .fbx files containing the rig and animations.
    The files are named as follows:
    [model_name].fbx - This file contains model + rig.
    [model_name]@[animation_name].fbx - this file contains rig + animation.

    When the animations are played the mesh rotates (usually 270 x, 90 y) and is not animated properly. It seems as though the mesh isn't skinned at all.

    The Solution:
    The problem, at least for me and some other people, was that the files containing the animations only had one object in it's root. For some strange reason this does not work well with Unity (if anyone can explain why it works like that ... ).



    The solution is to simply add an object that doesn't share the same hierachy as the rig in the animation files (in the base file the mesh acts like this object).

    Here is a video of the problem and solution.

    I'm not perfectly sure that I'm posting this in the right section but here goes.
     
  2. Paulius-Liekis

    Paulius-Liekis

    Joined:
    Aug 31, 2009
    Posts:
    672
    The reason why it works this way is:
    When Unity import file with mesh and skeleton (two or more object in scene root) it has to add extra root bone for such object, because Unity doesn't support multiple roots. When Unity import file with just a skeleton (a single root object in scene) it takes it without any modifications. These two behaviours causes mismatch between mesh and animations...

    It a bug/problem in Unity, we have a bug report on it and we will fix it...

    Regards,
    Paulius LIEKIS
    Unity Technologies
     
  3. Zanardi

    Zanardi

    Joined:
    Oct 4, 2010
    Posts:
    7
    Just to be sure, it was cleared?
    It is not that Im lazy... Im discovering unity now.
     
  4. Paulius-Liekis

    Paulius-Liekis

    Joined:
    Aug 31, 2009
    Posts:
    672
    No, it has not been fixed yes as we don't have good solution for this issue, but we're aware that it causing problems...
     
    CloudyVR likes this.
  5. Zanardi

    Zanardi

    Joined:
    Oct 4, 2010
    Posts:
    7
    Just to be sure, Im new to Unity and I will work on a challenge "do a game in 40 hours" using unity and 3dmax... Sorry for asking without enough knowledge, I will work on max but our Unity developer does not know much about bones and animation.

    The way to surpass the problem is to insert any kind of extra bone, outside the original skeleton, so export the fbx?
     
  6. Babaa

    Babaa

    Joined:
    Nov 24, 2009
    Posts:
    47
    Yes
     
  7. BloodWist

    BloodWist

    Joined:
    Dec 24, 2011
    Posts:
    1
    This bug have been fixed? Because I'm dealing with this exactly same problem.... I'm using the 3.4.2f3 version. I have the 3.5.0b6 version but I don't wanna upgrade my project for a beta version without having sure that this will fix the issue.
     
  8. x1alphaz1

    x1alphaz1

    Joined:
    Dec 19, 2020
    Posts:
    23
    For Anyone who's facing this issue.
    U need to set the rootbone position of the attached object to the position of the Main SkinnedMeshrenderer rootbone position

    **Example:**

    O1 = Main.GetComponent<SkinnedMeshRenderer>();
    O2 = Attached.GetComponent<SkinnedMeshRenderer>();
    O2.rootBone.transform.position = O1.rootBone.transform.position;
     
  9. eliteforcevn

    eliteforcevn

    Joined:
    Oct 25, 2018
    Posts:
    47
    it show but my animation is incorrect