AnimControl Nullpointer

Everything was fine until i added the following code,

[java] t_animControl = geo_turtle.getControl(AnimControl.class);


t_animChannel = t_animControl.createChannel();



when I add these lines, i get null pointer error.

but, the code looks ok, and everything else is.I also tried with commenting out the last two line of it,but no improvement.When i comment out these 4 lines, program runs as it should.

I am am new in java, so, I am a little confused…I also had the following code in my simpleInitApp.

[java] animControl = geo_player.getControl(AnimControl.class);


animChannel = animControl.createChannel();

animChannel.setAnim("standing"); [/java]

Is this what it might be conflicting with?

geoplayer and/or geoturtle is null (not set). Since you are new to java one technique you want to learn for any programming language are debugging skills. In java it depends on what compiler you are using or what debugger you have installed. If you don’t know you can use the simplest form of debugging, print statements.


If you receive a null in your command window then thats your problem, you can try to print out all the objects. Also the stacktrace when you get an error usually pinpoints the line in which is causing the problem.

I had this problem before.

The reason is actually not because ur character is null.

If you try to add it to the rootnode ull see its there.

But the problem is using xml and armature in jme3.

To fix this,

Assume your xml models is called character

  1. Download jme platform.
  2. Then in one of their folders called Models (its one for each project u create),

    add the character.mesh.xml and the character.skelleton.xml
  3. then change you’r Scene.material to character.material
  4. Add ur character.material to the models folder where your character.mesh.xml exsist
  5. Double click the character.mesh.xml file and a new file called character.mesh.j3o is created.
  6. Find that file in ur hardrive and copy it.
  7. Paste it into you’r old place where you’r real character.mesh.xml exsist.

    Now load character.mesh.j3o INSTEAD of character.mesh.xml

    Then it should work fine :smiley:

    Took me some days to find this out, just managed to fix this yesterday :smiley:

I re-did the whole thing and used node instead of geo…now this issue is solved, but, geo_model wasn’t null.