Blender importer and multiple bone animations

Hey everyone,

I have recently come accross a problem with multiple bone animations loaded from the blender file.

The BoneTrack uses the initial transformation of the bone and adds a proper value to it depending on which place in the animation it currently is.
But unfortunately the behaviour of such bone strongly depends on what was its initial pose.

Let me describe a simple example.
Lets assume that we have a bone and create its animation where we only alter the X position.
We have two key frames: [0] with translation (1, 0, 0)
[1] with translation (10, 0, 0).
The bone’s initial pose is (-1, 0, 0).

In blender, the bone would move from (1, 0, 0) to (10, 0, 0) when the animation is played.
But in jme it moves from (0, 0, 0) to (9, 0, 0).

It happens because BoneTrack first sets the initial pose (which is (-1, 0, 0)) and then adds the value from the tracks.
When the time is 0 the track value is (1, 0, 0).
So: (-1, 0, 0) + (1, 0, 0) = (0, 0, 0).
And at the end of the animation: (-1, 0, 0) + (10, 0, 0) = (9, 0, 0).

This behaviour is quite a large problem because the bone always has some initial pose. If you create a skeleton and add 10 different animations to it, you might have 10 different staring poses of your bones. Blender always uses the direct values from the tracks and this way it alters the bone’s transformations. JME usses additive values which will never work corrctly unless the starting transformation is (0, 0, 0).

Some time ago I created a SpatialTrack class that animates the whole node. It directly uses the data read from the track and applies it to the node. In this case the animations look OK no matter where the object was located at the start.

We have several different solutions to solve the problem:

  1. alter the BoneTrack so that it uses data directly stored in the track (without the use of initial pose)
  2. make blender importer load the differences between the first and every other frame of the animation and store such data in the track; but in order of it to work - the initial data should be attached to the BoneTrack (or any other class you want) so that it can be properly set when the animation starts; nothing would be done if there is no initial data
  3. create a class named DirectBoneTrack and add it to the core; this class would directly apply data loaded from track to the bones

I would prefer the 2’nd solution. The first change would make a lot of mess with currently working projects and the 3’rd one would create additional class to handle - I am not sure if that is really necessary.

Please let me know what you think about it. And of course correct me if I am wrong :wink:
I know that the topic is not trivial so ask if I am in any way unclear in the description above.

Really nobody’s gonna say anything about the problem ? :frowning:

@Kaelthas said: JME usses additive values which will never work corrctly unless the starting transformation is (0, 0, 0).
That's wrong. Each frame transformation is applied to the initialpose of the bone. Maybe the issue is that you didn't set it properly. Each bone has already an initialpos.

The problem occured because I loaded the bones in rest mode and applied poses later.
Without applying the poses it looks OK again.