I have a blender model that has many different animations. I am trying to use the walk animation.
AnimControl control = characterNode.getControl(AnimControl.class);
control.addListener(new AnimEventListener() {
//empty event listener methods are in here
channel = control.createChannel();
channel.setAnim("walk");
I am getting a NullPointerException
Uncaught exception thrown in Thread[LWJGL Renderer Thread, 5,main]
I think that it has to do with the AnimControl.class being empty. Anything helps. Thanks in advance
In my experience problems like this are nearly always to do with loading the blender model. Depending on which loader you use (there are two) you won't receive a reference to the part of the model that contains the animation control from loadModel
. I find I need to provide a name in the Blender object hierarchy to the object (not the parent armature) that contains the Animation. I then use model.getChild()
to get the right named object in the loaded model hierarchy.
It is worth using your debugger to break the code just after the model is loaded and then walk through the hierarchy checking where the AnimControl
is located. This will also give you a feel for how the loader arranges the objects in your model.