Hi all,

I successfully loaded the xml animation into my node, and it plays wonderfully. The selection of animation is the trouble.

Here’s my code for loading:

SAXReader sr = new SAXReader();

        Node model = null;
        try {
            URL modelU = ConvertMd2XML.class.getClassLoader().getResource(
            model = sr.loadXML(modelU.openStream());
        } catch (IOException ioe) {
                    ioe.getCause() + ": " + ioe.getMessage());
        kc = new KeyframeController();

and here's my animation selection:


Do I have to set the keyframes myself? or are they included in the xml?

if I dont set any keyframes, it exits and I get this error:

java.lang.IndexOutOfBoundsException: Index: 1, Size: 1
   at java.util.ArrayList.RangeCheck(
   at java.util.ArrayList.get(
   at com.jme.scene.model.XMLparser.KeyframeController.update(
   at com.jme.scene.Spatial.updateWorldData(
   at com.jme.scene.Node.updateWorldData(
   at com.jme.scene.Spatial.updateGeometricState(
   at com.jme.scene.Node.updateWorldData(
   at com.jme.scene.Spatial.updateGeometricState(
   at com.volatile7.xv.ConvertMd2XML.main(

if I set keyframes, it works fine, but the selection doesn't happen. it just loops like a normal animation.

Any thoughts?[/code]

What is player.xml? If it is a MD2 file, MD2’s make their own KeyframeController because they define their own animations.

When you set the MorphingMesh for kc, you set the mesh that will be displayed (will get morphed), but you didn’t give kc any “frames” to morph to (You didn’t tell it what to look like at time=0 time=5 time=3 ect ect)

If the XML file is a md2 model, then it is setup like this (and the KeyframeController is already defined, so you don’t need to create a new one)

The file is a Node with one child

That one child is the mesh that is displayed (cause it’s a child to the node), and it has a controller that animates it.

That controller is the keyframe controller. It has an array of states at times.

Controller c=model.getChild(0).getController(0);

The index error is that KeyframeController assumes you have put in at least two keyframes, otherwise there wouldn't be any animation.

When you say you were setting keyframes, how were you setting them?

The use is still up in the air, so if you think of a more intuitive way to structure how users setup and use the md2 let me know.

One more clarification on what I wrote below, when you load from the XML file you’re not -really- loading a md2 file anymore. You’re loading a TriMesh with a KeyframeController that will look like a md2 file. The purpose of the XML format was to take away the “.md2” and “.ms3d” and others and let users load directly into what jME needs and uses.

To stop the animation you would use


and to speed it up or slow it


My next goal is to allow smooth morphing between one set of keyframes to another. For example if your guy is running then you have him shoot his gun it looks like he teleports to the correct position. I'll try to add a feature to allow users to morph directly between any two units of time

aaah, awsome, and yes, player.xml is an md2 animation. Brilliant!