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

Blender FBX animation questions for Unity.

Discussion in 'Asset Importing & Exporting' started by Zombies1, Jun 29, 2010.

  1. Zombies1

    Zombies1

    Joined:
    Jun 28, 2010
    Posts:
    34
    I use Blender for my modeling/animation and I imported a simple character I made. When I place it in my test map, the player does the "Walking" animation I made in the Action Editor of Blender. It does it once and stops. I noticed in the asset list thing, there is the file name and inside that is... Armature, the character name and "Default Take". Default Take I'm assuming is the animations, but I have no idea how to access them (or tell my character which to use anyway). I haven't had my own character in Unity before, so I don't know if I messed up or if I just haven't been looking at the right thing, but is Default Take what I need, or should I use something else?
    One time I imported the actual .blend file and it had the animations named and in separate files, like Walking, Idle, Running etc... Which do I need? Can I import the animations like the .blend file, but import the model as .fbx? I would just like to know the best option. (when I import as .fbx I have to scale it up to 9 times the normal size to get it to be the same size as the .blend file's .3 scaling)
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    It is - from my point of view - the easiest way to import everything directly with the .blend file. If you have several animations they should all be imported. Here is a link to a very detailed explanation of what you should or should not do in Blender, such that your models and animations are going to work properly in Unity http://forum.unity3d.com/viewtopic.php?t=43550.

    Your animation problem:
    If you select the model in the Hierarchy, you should see an Animation field in the Inspector, which shows you the animation that is going to be played. If you want to have another animation there, have a look at your imported model in the Project pan. There should be a list of all your animations. Just drag the animation onto the animation field in the inspector.
     
  3. Zombies1

    Zombies1

    Joined:
    Jun 28, 2010
    Posts:
    34
    I don't quite follow the lingo with Unity yet, but I figured I would just use the .blend files. When I export as .fbx it turns all my animations into a "Default Take" and it only plays one animation of the whole thing. If I import a .blend file, the model is massively huge-tastic, but at least it puts all the animations there.
    I just used a Makehuman export and removed the skin and stuff and rigged the skeleton. I got it to walk, run and have a nice idle animation... except the hand slightly detaches when switching to/from the Run animation.
    I think I'm just going to use .fbx for non-animated files and use .blend for characters/monsters etc. Thanks for the link, I'll check it out o_O
     
  4. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    If you call your exported file like this :

    $fbxFile = $yourSkinnedModelName + "@" + $animationName;

    The "Default Take" will be replaced by $animationName.

    The key is the "@", this unity's workflow.
     
  5. Zombies1

    Zombies1

    Joined:
    Jun 28, 2010
    Posts:
    34
    I have absolutely no idea what that means. I've just been importing as .blend, seems easier. Is there a downfall to .blend files that I don't know about?


    Edit: No matter what I do, I can't seem to get the fingers to stay attached to the hand when switching from Idle/Walk to Run. The arm is supposed to raise, like with a sword in it's hand. What happens is the elbow, arm and hand rotate just fine, but the fingers move straight between the 2 points, which looks very strange. Does anyone know in Blender how to fix this problem?

    The path of the hand/arm from behind is like a ")" shape, but the fingers, which are supposedly attached to the hand, just go straight up like a "|" . Any ideas?
     
  6. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    You have to be sure that every vertex in the fingers is weight painted. Else you get such strange behaviour.
     
  7. Zombies1

    Zombies1

    Joined:
    Jun 28, 2010
    Posts:
    34
    Yeah, they are all connected to the proper parts. I avoided the problem by making the arm not go up as far. It makes the animation look a bit lame, but at least no fingers popping off between animations. I'd still like to know how to fix it, not just avoid it. I don't know why they detach to begin with. I used the same method I did for the leg/foot and the toes don't pop off like the fingers do...
     
  8. sama-van

    sama-van

    Joined:
    Jun 2, 2009
    Posts:
    1,734
    3 things about Unity :

    - to disable the Key-frame Reduction on your animation node can help to get the right animation you had from the beginning.

    - Unity has a limit of number of bone per vertex. I am not sure, maybe 4 or 5? after that it could create bugged thing...

    - Better to separate the rig from your skeleton when importing your model.
     
  9. stefano001

    stefano001

    Joined:
    Jul 15, 2009
    Posts:
    27
    Dear Zombie1,

    In order to get rig of the problem on the fingers I would try to plot in Blender keyframes on each frame before importing in Unity. The problem may have to do with not having keys on all channels for the fingers on one of the two animations.

    If you need a lot of animations for your game, another strategy you can try is to upload your FBX character to Mixamo and choose the animations you need. Mixamo will automatically retarget the motions to your rig and you will be able to download them in FBX ready for Unity (including the character@animation.fbx naming convention). Just another option to get your game up faster ;-) I hope this helps!
     
  10. Piero

    Piero

    Joined:
    Sep 17, 2010
    Posts:
    33
    Sorry guys, I'm reading a lot of stuff on these issues but I miss something.

    If I place the .blend file in the Assets folder, I get a white empty icon in the project view.
    So I tried to export the fbx from blender manually.
    The options are:

    - (rotation options)
    - modifiers
    - optimize keyframes
    - copy image file
    - selected objects
    - armatures
    - lamps
    - cameras
    - own dir.
    - enable animation
    - all actions
    - group>file
    - HQ normals
    - enable batch

    The mesh is parented to the armature and there is only one animation.

    If I export the mesh and the armature without animations/actions the mesh is ok, but of course it does not have animations.
    If I export the mesh and the armature with animations then unity can play the animation but the mesh is totally deformed.
    If I export the mesh and the armature with actions then I get a "default take" animation not working, and the mesh is ok.

    I tried to manually weight paint vertices, to make groups, and every possible combinations for the above options.
    I'm trying to get over this since two weeks, please help...
     
  11. Piero

    Piero

    Joined:
    Sep 17, 2010
    Posts:
    33