Animated Models

To make an animated model, what files do you need? I have the .j3o, material, .mesh.xml. Do I need a skeleton? Also, the beginner’s tutorial Hello Animation doesn’t help a lot. What are the “Walk” and “Stand”?

Thanks :slight_smile: Will try and work something out of it :smiley:

Hmm… SEVERE: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]

java.lang.IllegalArgumentException: Cannot find animation named: ‘Action’.

What should I do?

This is my current code. When playing, an error is found: Cannot find animation named:‘Action’. Any suggestions?

package mygame;


import com.jme3.system.AppSettings;

import com.jme3.light.DirectionalLight;

import com.jme3.font.BitmapText;

import com.jme3.math.Vector3f;

import com.jme3.scene.Node;

import com.jme3.input.KeyInput;

import com.jme3.input.controls.KeyTrigger;

import com.jme3.input.controls.ActionListener;

import com.jme3.animation.AnimChannel;

import com.jme3.animation.AnimControl;

import com.jme3.animation.AnimEventListener;

import com.jme3.animation.LoopMode;


  • Ogre animation based on Hello Animation tutorial
  • author ste3e


    public class Main extends SimpleApplication implements AnimEventListener{

    private BitmapText sysout;//dubug to player screen

    private Node root, placeholder, player;

    private AnimChannel channel;

    private AnimControl control;

    private boolean play=false;//play or stop the animation

    public static void main(String[] args) {

    Main app = new Main();

    //remove initial screen


    AppSettings settings=new AppSettings(true);

    settings.put(“Width”, 640);

    settings.put(“Height”, 480);

    settings.put(“Title”, “My Game”);

    settings.put(“VSync”, true);

    settings.put(“Samples”, 4);





    public void simpleInitApp() {

    //the node “root” reorients the world space to coincide with Blender’s


    //writes to the play screen


    //hang the animation off a placholder that we can move without worrying

    //about the animation.

    placeholder=new Node(“placeholder”);

    //root is the reoriented world space





    //setup animation and set to Start animation as named in Ogre exporter





    DirectionalLight sun=new DirectionalLight();

    sun.setDirection(new Vector3f(-0.1f,-0.7f,-1.0f));



    private void initKeys(){

    inputManager.addMapping(“ccw”, new KeyTrigger(KeyInput.KEY_LEFT));

    inputManager.addMapping(“cw”, new KeyTrigger(KeyInput.KEY_RIGHT));

    inputManager.addMapping(“play”, new KeyTrigger(KeyInput.KEY_P));

    inputManager.addListener(actionListener, “ccw”);

    inputManager.addListener(actionListener, “cw”);

    inputManager.addListener(actionListener, “play”);


    private ActionListener actionListener=new ActionListener(){

    public void onAction(String name, boolean keyPressed, float tpf){








    if(name.equals(“play”) && !keyPressed){


    channel.setAnim(“Action”, 0.5f);




    channel.setAnim(“Start”, 0.5f);






    //need to implement listener methods

    public void onAnimCycleDone(AnimControl control, AnimChannel channel,

    String name){}

    public void onAnimChange(AnimControl control, AnimChannel channel, String



    public void simpleUpdate(float tpf){}

    private void debug(String str){



    private void reorient(){

    root=new Node(“root”);


    root.setLocalTranslation(new Vector3f(0.0f,-2.5f,0.0f));


    //disable standard settings



    private void enableDebug(){

    //For debugging



    sysout=new BitmapText(guiFont, false);


    sysout.setLocalTranslation(300, sysout.getLineHeight(), 0);




Use an animation that IS in the model (and channel), the animation ‘Action’ is not found for the channel you are applying it on, that’s all it says. try this to find what animations are available:

[java]for (String anim : control.getAnimationNames()) { System.out.println(anim); }[/java]

Ahh, just skimmed through the article linked above and noticed the error you are prolly making @memonick. I don’t want to be harsh but you appear to have no idea what you are doing :stuck_out_tongue:

Any model file may contain information about animations, and these animations are saved as a set of animations. Say, one for being Idle, one for Walk, one for Shoot, whatever the model contains. You are now trying to call the default animation named Action from the model in that tutorial on another model that does not conatin this animation.

Animation in a nutshell:

You are referring to an animation that does not exist on the current model, say, you try to make a baby move by telling it to Walk while it only knows how to Crawl, and thus cannot do the action you request, and throws back an error, whereas telling a grown up to Walk would result in that person walking.

I know, I tried to name part of the animation Action. However, I think that from 3DS Max I cannot export animations. I would be grateful if you could help me if it is possible.

I know, I tried to name part of the animation Action. However, I think that from 3DS Max I cannot export animations. I would be grateful if you could help me if it is possible.

I heard someone talking about an OgreXmlExporter for 3DS Max.

I have that exporter. It exports into .mesh.xml, but I don’t think the animations work. I guess I will have to learn to use Blender if no solutions come up…

Anyway if you are going to learn blender, i can tell where you can find nice tutorials in the internet :D:

Which version should I use? The google doc says he used just Blender and that version 2.5 is not supported yet.

No, you read a old doc. The lastest version of blender is 2.58. You can download it here. There are two nice importers for blender models in jmp “OgreXmlImporer” and “BlenderImporter”, but i advise you to use the BlenderImporter, because it’s much more pratic, just save the .blend file with blender, install the BlenderImporter for jmp, and load the .blend file directly and be happy :D.

Thanks! It can export .mesh.xlm? Also, does it support animation?

@memonick use 3d studio max and export it simple :

  1. click only the mesh parts not the skeleton !!!
  2. object properties - > mesh animation (add your animation here).
  3. export.
memonick said:
Thanks! It can export .mesh.xlm?

Yes, just install the ogre dotscene in blender and export your models. After that import them to jmp. But how i said before, another importer came to easy our lifes, the "BlenderImporter", then you can use it instead, just install it in jmp and import the blender files directly to jmp.

memonick said:
Also, does it support animation?

The OgreXmlExporter doesn't export animations properly to blender, but i think the "BlenderImporter" can importer the animations, i still didn't test it. Try yourself ;).

@tralala, where exactly is the second step? Do you think you can explain a little better? Have you checked it yourself?

glaucomardano said:
The OgreXmlExporter doesn't export animations properly to blender, but i think the "BlenderImporter" can importer the animations, i still didn't test it. Try yourself ;).

I forget to say the OgreXmlExporter can export animations for blender 2.49b, but not for blender 2.5x.

Ok, I will try it tomorrow. Meanwhile, @tralala, when I export, a .skeleton.xml gets created:

I previously named the Animations by going into OgreMax>Object Settings> Node Animation. However, the names (Start and Action) don’t appear in the above .skeleton.xml. The only thing that appears relating to the animation is .