Problem with animation


it seems many changes were made to animation system sice I last wored with it :wink:

The problem is - animations loaded from Blender worked and now they don’t.

Could someone run this example and tell me what is wrong?

From the blender importer side everything is made as it was before.

I think some additional structures are needed for this to work.


package jme3test.model.anim;

import com.jme3.animation.AnimChannel;

import com.jme3.animation.AnimControl;


import com.jme3.asset.BlenderKey;

import com.jme3.light.DirectionalLight;

import com.jme3.math.ColorRGBA;

import com.jme3.math.Quaternion;

import com.jme3.math.Vector3f;

import com.jme3.scene.Node;

import com.jme3.scene.Spatial;

public class TestBlenderAnim extends SimpleApplication {

private AnimChannel channel;

private AnimControl control;

public static void main(String[] args) {

TestBlenderAnim app = new TestBlenderAnim();




public void simpleInitApp() {


cam.setLocation(new Vector3f(6.4013605f, 7.488437f, 12.843031f));

cam.setRotation(new Quaternion(-0.060740203f, 0.93925786f, -0.2398315f, -0.2378785f));

DirectionalLight dl = new DirectionalLight();

dl.setDirection(new Vector3f(-0.1f, -0.7f, -1).normalizeLocal());

dl.setColor(new ColorRGBA(1f, 1f, 1f, 1.0f));


BlenderKey blenderKey = new BlenderKey(“Blender/2.4x/BaseMesh_249.blend”);

blenderKey.addAnimation(“BaseMesh_01”, “run_01”, 1, 40);

Spatial scene = (Spatial) assetManager.loadModel(blenderKey);


Spatial model = this.findNode(rootNode, “BaseMesh_01”);;

control = model.getControl(AnimControl.class);

channel = control.createChannel();




  • This method finds a node of a given name.
  • @param rootNode the root node to search
  • @param name the name of the searched node
  • @return the found node or null


    private Spatial findNode(Node rootNode, String name) {

    if (name.equals(rootNode.getName())) {

    return rootNode;


    return rootNode.getChild(name);




    This class can be copied to its package and run.

    I did not commit it because I do not know if it will be needed there.

My initial debugging seems to indicate that your BoneIndex buffer is full of zeroes. I’ll do a bit more debugging and hopefully find something

EDIT: Okay … Seems like MeshHelper.getBoneWeightAndIndexBuffer() is called before ArmatureHelper.buildBonesStructure(). buildBonesStructure() creates the bonesMap which getBoneWeightAndIndexBuffer() depends on, since there are no bones, the index/weight buffers are filled with dummy data. In other words, you have to load the modifiers (armature) first before you can load the mesh


it seems like the problem is solved.

I managed to run the animation :wink:

I don’t know what was wrong, but after small refactoring it turned out to be working :smiley: