# Why do some bones in an animation lose their position when applying scale to their armature?

After starting with a stock armature with a run cycle I added a few of my own bones for various armor pieces on my model. As the stock model is too large for my game and the engine requires me to apply the correct scale before export I scaled the armature down (my mesh is a child of it). After applying the new scale and viewing my run cycle the bones from the stock armature I built on top of are fine, where my new bones explode out to new positions in all directions. It feels to me like the individual origins of my new bones are offset somehow, obviously I have missed a crucial step when adding them, what was this step, and how can this problem be fixed?

Before:

After applying scale:

Generally if an armature already has animation data, it's not safe to scale it and apply the transformation. It has something to do with changing the armature object's transformation matrix, because each keyframes in an action for a bone is recorded and evaluated against it.

To illustrate, here I have a keyframed armature, and I just add a free-floating bone parented to torso:

If I halve the armature's size in object mode, each bone's matrix stays the same:

But after I apply the scale transformation, it's a different matrix for each bones:

Whatever matrix operation is applied against the keyframe data, no longer turns out the correct transformation. In my experience, only free-floating bones are prone to this problem (the feet doesn't stray like this when animated in FK).

• I invite correction, because my understanding of how transformation matrix works is still very limited.