Search Unity

  1. Unity 6 Preview is now available. To find out what's new, have a look at our Unity 6 Preview blog post.
    Dismiss Notice
  2. Unity is excited to announce that we will be collaborating with TheXPlace for a summer game jam from June 13 - June 19. Learn more.
    Dismiss Notice
  3. Dismiss Notice

Resolved Animation import (Blender->Unity) distorts planes

Discussion in 'Animation' started by terylangosh, Apr 3, 2024.

  1. terylangosh

    terylangosh

    Joined:
    Oct 3, 2022
    Posts:
    2
    Hello,

    I have encountered a problem when importing an animation of the scale of planes.

    I have an animation made in Blender and exported into .fbx. Each plane (leaf texture) changes its location and scale independently of others (each plane is an object, I do not animate individual vertices). If I import this animation back into Blender it works as intended, however, when importing it into Unity, some of the planes become distorted and behave strangely. I have disabled animation compression and mesh optimization and removed the "weld vertices" option in the import settings and nothing helps. I have applied all of the transforms (so they have scale of 1.0 on all axes) before animating it, so this should not be a problem. The animation keyframes all capture location, rotation, and scale, so no data should get lost. I also tried to drag and drop the .blend file directly into Unity without exporting it into .fbx, but that also did not fix the problem.



    Below are the animations in Blender and Unity - as you can see, the tree should have leaves on the bottom, but those seem to have the scale of 0 on the vertical axis at the beginning and in the end, the other two axes are squished.

    Does anybody have any suggestions on what I should try to solve this problem?


    Unity animation at the beginning, after a few frames, in the middle of the animation and at the end:


    Blender animation at the beginning and middle (the leaves just get smaller progressively):


    View of the planes in Blender (close up):


    EDIT:
    I also tried exporting the leaves separately from the rest of the tree, but now I get an error in the console:
    "
    ImportFBX Errors:
    Take/AnimStack 'Scene' contains animation curves with invalid numbers (NANs) on these nodes (R - rotation): 'Leaves' (R), 'Leaves.001' (R), ...
    "

    When I googled the error, I found information (at https://issuetracker.unity3d.com/is...ue-when-fbx-assets-are-imported-to-the-editor)
    that "This error indicates corrupt FBX file. In some case this error can be caused by having 0 scales in animation. 0 scales are not supported in FBXSDK. Use very small scales (like 1e-5) instead."

    When I changed the final scale from 0 to a value close to it, it fixed the animation partially, but not completely, see below. There are not that many distorted fragments, but there still are some.
     
    Last edited: Apr 3, 2024
  2. terylangosh

    terylangosh

    Joined:
    Oct 3, 2022
    Posts:
    2
    Okay, so for anyone who might have the same problem. I have no idea why this worked (if Unity or .fbx have some size limitation) but this if what helped me:

    I simply exported the animation in two parts - leaves on top and bottom. This fixed all the distortions and everything works as intended.