Animation, Cannot keep character feet on ground

I have a problem that when I play a crouch to stand animation, the model sinks into to the ground and then returns to the correct position.

I have a character that is controlled by a networked remote player. When the game receives a message that the character has squatted or stood up, I play the corresponding animation. The character model is a child of a transform with a capsule collider and rigidbody.

When the stand/squat animation plays, I adjust the character models transforms local position in time with the animation so that it’s height is adjusted to the correct position at the end of the animation.

The stand to squat animation works reasonably well, feet sink slightly into the ground for a few frames.

The problem: The squat to stand animation results in character sinking into the ground. If I don’t adjust the transform height the character floats in the air before returning to the ground.

I am a novice with animation and I am struggling to find reference material to help me out with this problem.

I think a clue to my problem can be seen with the blue ball gizmo’s. When standing, the lower one sinks into the ground, exactly like my character. I can’t find out what these gizmo’s are telling me.

I have played with the Animation options on the imported FBX. Root motion is off. The character is rigged as Humanoid. But I can’t find out what is controlling the downward movement of the character pushing it into the ground.

I feel like my approach is much harder than it needs to be. Is there a simpler solution, or a way to extract from the animation the height I need to set the avatar? Or other answer…

Video of problem:

http://youtu.be/MnNRzhHbZ1I

You need to bake into pose.

That is, in the inspector for the FBX, on the animation tab, For the Root Transform, check the 3 bake into pose options and apply.

42802-2015-03-18-19-41-08.jpg