Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.

Blender with Unity, possible bug?

Discussion in 'Editor & General Support' started by Sequence, Feb 4, 2012.

  1. Sequence

    Sequence

    Joined:
    Feb 4, 2012
    Posts:
    44
    Hey everyone,

    Unity has been great so far, it's really nice to work with. The ease of importing .Blend files is great, but I've been having this one problem with animations that I can't seem to solve. A while ago, I tried importing a character that I've rigged and animated previously. But upon trying it in Unity, to my dismay, the animations weren't behaving properly. When I told the character to play the walk animation in the script, other animations would mix and play with it, even though I never said to play them! Thus, I got a character that's walking while laying down like it's dead.:( Since the character was originally a mod for another game, and since it was one of my earlier works, I figured I'd just take an old backup of the model and re-rig/animate it. Upon doing so, it seemed to work fine. The character would walk when expected to walk without any other animation unexpectedly mixing with it. But later, I realized that I needed a death animation. I didn't make a death animation for my newly re-rigged/animated character, so I figured I'd just add it. I wen't into blender, cooked up a death animation, then wen't back to Unity. But, once again, the same problem reared it's ugly head. Upon walking around, the character promptly flopped down into it's death animation. I've googled around a lot and haven't found anyone else with this problem. I'm using Mac OS 10.6.8 with Blender version 2.49b and Unity version 3.4.2f3. I've included some pictures below, but note, this is just a simple test animation, and not the actual death animation. Thanks in advance for anyone willing to help. :)


    Here's a picture of my Blender project. The new animation I'm trying to add is titled "Jerry". As you can see, the animation simply bends the neck backward.


    But when I go back to Unity and try to jump(It decided to screw up the jump animation this time instead of the walk animation) I get this...


    And these are my animation settings...


    I could hand over my .Blend file if it will help.
     
  2. Dantus

    Dantus

    Joined:
    Oct 21, 2009
    Posts:
    5,667
    The .blend file would definitely help.
     
  3. Sequence

    Sequence

    Joined:
    Feb 4, 2012
    Posts:
    44
  4. AngryBear+^

    AngryBear+^

    Joined:
    Apr 4, 2009
    Posts:
    68
    Out of curiosity, you're only keyframing the parts of the rig you want to move in that animation, yes? To allow for nice blending between animations? That's what I can gather from the pic.
    I had this problem before with some basic facial animation. It seems that, in the list of actions in the Blend file, Blender's FBX exporter fills in any keyframes for other bones based on the previous animation. For instance, for my character blinking, the exporter also inserted keyframes from one of his aerial attacks.
    The way I got around it was to do the following in Unity:
    Duplicate the animation you want to work with (in my case, this was the character's blinking animation).
    Modify the duplicated animation using Unity's animation system, removing curves for bones that have nothing to do with the animation.
    Have your character use this modified animation instead of the originally imported one.

    You need to duplicate the animation because when blender actions are imported into Unity, that animation asset becomes read only. The duplicate doesn't share this restriction.

    Hope that helps.
     
  5. Sequence

    Sequence

    Joined:
    Feb 4, 2012
    Posts:
    44
    That sounds just like my problem, thank you so much!:D I'll try it out and report back.

    EDIT: Fixed one animation, but then another animation got messed up. XD So I tried fixing that one and apparently after deleting the "unwanted keyframes" I realized that those keyframes were needed for the animation I was trying to fix (Jump animation). But the problem is, unity mixed the unwanted keyframes with the jumping animation ones because I use the same bones for both of them. Thus, deleting the "unwanted keyframes" deletes part of the jump animation as well! I'm thinking it would make sense to make almost blank "spacer animations" in blender.(Probably need to add some keyframes so Unity imports them.) So then when unity goes and mixes the previous animation with the current one, it mixes one of the "spacer" ones and everything would be fine, right?
     
    Last edited: Feb 7, 2012
  6. Sequence

    Sequence

    Joined:
    Feb 4, 2012
    Posts:
    44
    I think the spacing technique worked! Here's what I did:

    "Z2" is the spacing animation. "Z1" is the animation that would normally screw up everything. As you can see in the picture, Z1 is below Z2. Z1, being an animation that will mix with the previous one, mixes with Z2, which is a spacer animation with 2 keyframes. The result? All the other animations are untouched!
     
    Last edited: Feb 7, 2012
unityunity