Problem with loading armatures in certain models

Hey guys,

I have been working on constraints for some time and recently I came accross a problem with skeleton loading.
So far most of the models loaded bones correctly, but then I created a very simple model and it did’t load as expected.

Here is the model:

If there is someone who could analyze the code that loads and sets bone matrices in blender loader I would be grateful because I still do not know
where is the problem :confused:

The armature loading begins in ArmatureModifier class.
In line 102 a matrix that ‘moves’ the armature from its own space to the animates mesh space is created.

And the bone loading is done in BoneContext class. In constructor armatureMatrix is read from the blend file and restMatrix is computed.
This was implemented basing on the ogre importer.

And in the end the buildBone method in BoneContext is called that created the bone.

The main problem with this particular model is I belive its scale. The mesh was scaled by 0.5 in all directions and its origin is in (0,1,0) when loaded in jme (it is [0,0,1] in blender).
When I apply all the transformation to the mesh the model loads just fine and animates correctly.

Any help will be greatly welcome :wink:

Isn’t it standard policy to tell people to apply all transforms before doing any blender imports anyway?


in general it is. But it would be much better if the user did not have to do that.
I am 100% sure it is possible to properly compute all the transformation matrices.
I just still have no idea where is the bug :wink:

1 Like

OK I made a fix to that :slight_smile:

It mostly works now.
There are still issues when the model is scaled and animation applied but I hope to fix that soon.

If someone feels like the animation is not working correctly please still apply the transformations to your model.

1 Like