Animation from Blender to Unity

I’m having an issue getting the correct animation in Blender to work in Unity. To explain succinctly, I’ve been testing a “snake” animation that uses a Spline IK constraint on the armature to get the proper bending/slithering, etc. The problem is, the Unity animation doesn’t properly play (does sort of a see-saw animation as if there’s only one bone in the armature instead of an undulating snake).

So, how do I get animations that have an armature - which is dependent on modifiers and constraints - in Blender to carry over properly into Unity? What does baking do (I tried several different “bakes” on the armature/mesh/spline and still the same result)? What do I need to do if I’m using FBX for all of this?

I’ve looked in several places and it seems like tutorials either ignore or gloss over things like this (or I might not be looking hard enough).

Mind pointing me in the right direction?

There are lots of steps where things can go wrong :slight_smile:

Usual issues: Have you applied rotation and scale to your character so that it is scale 1 and rotation 0/0/0? Is your rig correct? Maybe vital parts are not proper weightpainted. And note that you can only export bones animations. No vertex animation / shapekeys. Is your interpolation mode correct? Do you maybe need more keyframes? Have you tried to record ALL keys for a keyframe (whole character)? How do you export ? When by FBX, have you ticked selection only? When yes, is there by chance another bone system in the scene? Blender grabs all animation available in the scene and exports it with the selection then. No matter if the animation is really part of the selected armature or not.

Thanks for the response!

Most of those are things I’ve tried. I’m curious, does selecting ONLY the mesh bring over the armature also? It sounds like it from your explanation.

But back to the issue - it seems like my problem is baking those key-frames generated by the constraints/IK Spline onto the bones. For some reason, I cannot find anyway to do that.

I have empty objects that control how the spline moves (which is constrained to the armature bones). How do I translate the information from the keyed constraints/empties onto the bones?

Shameless bump in hopes for another response. :face_with_spiral_eyes:

Hi, take a look at this. Maybe it will help you

Hey, thanks! I’ll take a look at this a little later today, it seems to be the thing I’m after.

Well, unfortunately that didn’t work. For some reason the animation goes into Unity as one solid bone. So, instead of the mesh undulating with the bones (about 5 on the test armature) like it does in Blender, the mesh just rocks back and forth like a rigid plank of wood in Unity. I don’t understand why it’s not taking the baked key-frames on the bones.

This is getting frustrating. -_-

If you want to post the blend file you are using I’ll be happy to take a look at it and get you instructions on how to get it into Unity

https://dl.dropboxusercontent.com/u/17565551/animation_files/snakeAnim_test.blend
https://dl.dropboxusercontent.com/u/17565551/animation_files/tutorialSuggestion_test.blend

The first link is my attempt at constraining bones to curves and empties. The second link is the result of following the tutorial link mentioned by bls.

Thanks for looking at them.

You make at least two things that turned out to be troublesome for me in the past.

  • No weight painting on the mesh
  • You are not using actions

I know there are ways without actions, but that’s what worked for me most reliable.

Dantus is correct. You are using bone envelopes instead of vertex weights to bind the vertices to the bones. The easiest way to fix it is to select the mesh object, then shift select the armature and hit Ctrl-P, then choose Armature Deform->With Envelope Weights or With Automatic Weights.

Wow…that was it. I didn’t realize there was a difference, but now it makes sense. Thank you so much!

Go figure, something so simple.

(bookmarked)