Mecanim - Blender Animation - Model translates more and more from its origin

Hey guys,

i'm pretty desperate. I scrolled through many forums and solutions for a problem i can't fix. I'm using Blender for Animations and export as .fbx to Unity. I placed a "Root"-Bone which is on (0,0,0) and its only task is to be a reference, where the character supposed to be. Rest of the hierarchie is excact as Mecanim needs it to be: Root -> Hips -> Spine -> ... In Blender i used the "Action Editor" and did all the "F" Stuff to connect the action to particular bones. I want to animate the upperbody seperately from the lowerbody, so i created a mask for the upperbody to be override in Unity. I do have "ub_Idle", "ub_walk", "ub_run" same on lowerbody ("lb"). I'm using a statemachine where the "runningspeed" indicates if the object is moving in space. So i set the transitions "if runningspeed greater than 0.1"-> Locomotion Blendtree and the other way round. My character moves not by pushing wasd-keys or arrow-keys but with rightklick on the ground to point his next place to be. I also tried a model with animations from the internet as a placeholder, which does no problems. So i assume it has to be a problem with my animations/ with my pipeline or so. So much for you to know about the setting.

I'm using follow settings at the "animations"-tab of the source-.fbx-file:
1376762--69667--$Settings.PNG

THE PROBLEM:
When i'm moving my character in the scene, it seems like everything's okay. After about 20 clicks or so, the model offsets click by click from its place where it should be (the green circle). The model is parented to an empty object which is moved by code.
This procedure don't stop. I could click 300 times and the model would be out of sight of the game-camera.

1376762--69668--$Problem.PNG

I tried so hard to avoid this offset but i can't explain myself where this comes from. For example:
- I gave the rootbone keyframes on 0,0,0 to ensure that he doesn't move
- I moved the hipbone securely so it only receive translation on the vertical axis
(btw. not every bone has a keyframe in the animations)

I would appreciate a lot if you smart guys had an answer! If you need further information to understand this case, i can give you on your demand. :)

Kind regards,
Xinodir

Still couldn't fix it... help me :'(

I will try:
- exporting in another format as .fbx
- and maybe tweeking the animation-data

Other formats don't work. Just tested it.

I will post a video to demonstrate the problem:
http://www.youtube.com/watch?v=c3WQp_Aom9M

Seems like after some clicks the mesh gets a offset into Z direction? Don't know how to fix this maybe its a Mecanim problem?

Hey,

I've had a similar problem with blender and in-place animations in Unity using Mecanim. However, after looking at the video, I think your problem might be a bit different. In any case: my advice would be to look at the preview window for your animation first and see if there is an offset from the origin in the preview.

If there's no offset in your blender animation, the problem is most likely in the way you use Mecanim.

By default, Mecanim calculates the "center of mass"of your character. Every frame of animation, a projection of this center of mass on the y-plane is made. This projection is the root transform (you can read more about it here: http://docs.unity3d.com/Documentation/Manual/RootMotion.html). This root transform is applied to your gameobject at every frame and was causing my animated character to generate an offset from it's intended position. You can stop Mecanim form applying a root transform by unchecking a box "Apply Root Motion" which can be found as a parameter in your animator component. The way I understand it (and correct me if I'm wrong), Mecanim intends to use your character's animation to drive the character itself instead of using in-place animations and adjusting the transform in a script.
Another easy way to determine if Mecanim is causing your problem is to try the legacy animation system and see if that solves your problem.

Hope this helps.

Cheers,

Sam

Seriously Sam, I closely collapsed in front of my PC in the middle of my office...... tears in the eyes, laughing and crying at the same time. If i meet you, i will kiss your feet. You're my official hero of the (at least) month!

PROBLEM SOLVED.

(I gave myself several facepalms.....) :smile:

Ha! Such a simple fix, saved me a headache too! Good work SamAgten :)

I noticed the same problem and tried using a script over ride to reset the transform position as i was running my animation. I was able to come with a solution to fix the problem with the free version where I couldn't put a curve into the mecanim animation for the size of the collider. I did a time change check and adjusted the collider based on time of animation vs what the animation should be doing. The mecanim looks great but it adds some difficult issues with gravity support. I think I am going to remove root control and control all my motions through my script. It adds complexity to pair the two up.