0

when I copy code from this tutorial https://jmonkeyengine.github.io/wiki/jme3/beginner/hello_animation.html, everythink works correctly. But when I change the model from example to my, which I made in Blender, it writes error java.lang.NullPointerException. It is because of:

control.addListener(this);

And it is because "control" is null. And it is because previous instruction:

control = player.getControl(AnimControl.class); 

gives null to variable "control". So what is the solution? When I try example code from tutorial, it works correctly, but when I replace the model name(path), it doesn't works. (Path of model is correct, because when I only display my model, it load the model correctly).

Petr Marek
  • 595
  • 5
  • 19
  • 1
    I think this is not a duplicate of the other question. It's an NPE, yes, but the difference is that the object is not added in the code in the tutorial, it has been added in an editor. This makes it non-obvious to an inexperienced user. Reading the answer will not solve this issue. The reason is that the model you made in Blender doesn't have an AnimControl. I think that if you add any animations (actions in blender) the converted model will have one. Alternatively (but I can't verify if I'm correct right now), you can add an one through the SceneComposer. As a third option, add it in code. – reden Oct 12 '16 at 11:42
  • Correction: Simply adding the AnimControl in code will solve the issue of the NPE. It just won't give any functionality. – reden Oct 12 '16 at 11:49
  • Had similar issue - in my case, on export to ogreXML from blender I forgot to switch the option to include animations. Model exported without animations, was loaded to jME and with no animation, there was no AnimControl. – r3mbol Oct 24 '16 at 12:06

0 Answers0