Nathaniel Nathaniel - 9 months ago 86
C# Question

Blender animation to XNA distortion bug

I followed the instructions on the following video:

I'm using XNA 4.0 and Blender 2.69

I export the model with animation to a .FBX file.

The animation is a man waving

Here is what it looks like in Blender:

And here is how it renders in XNA:

The arm where the animation occurs is greatly distorted.

I believe the error occurs in the AnimationPlayer class:

/// <summary>
/// Helper used by the Update method to refresh the WorldTransforms data.
/// </summary>
public void UpdateWorldTransforms(Matrix rootTransform)
// Root bone.
worldTransforms[0] = boneTransforms[0] * rootTransform;

// Child bones.
for (int bone = 1; bone < worldTransforms.Length; bone++)
int parentBone = skinningDataValue.SkeletonHierarchy[bone];

worldTransforms[bone] = boneTransforms[bone] *

/// <summary>
/// Helper used by the Update method to refresh the SkinTransforms data.
/// </summary>
public void UpdateSkinTransforms()
for (int bone = 0; bone < skinTransforms.Length; bone++)
skinTransforms[bone] = skinningDataValue.InverseBindPose[bone] *

I think the bug can be fixed by editing the code above, I just don't know how to do it.
Can somebody help me fix this distortion bug?

Here is a link to the project source code:

Here is a link to the Blender file:

Answer Source

Found the problem. XNA's content pipeline doesn't seem to be able to handle animated FBXs correctly. So XNA has a bug. Luckily Blender 2.68a and older has a "fix" for this. Just check "XNA rotation animation hack" when exporting the FBX.