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(
"com/data/models/player/player.xml");
model = sr.loadXML(modelU.openStream());
} catch (IOException ioe) {
LoggingSystem.getLogger().log(Level.SEVERE,
ioe.getCause() + ": " + ioe.getMessage());
}
kc = new KeyframeController();
kc.setMorphingMesh((TriMesh)model.getChild(0));
model.addController(kc);
rootNode.attachChild(model);
and here's my animation selection:
kc.setMinTime(0f);
kc.setMinTime(2f);
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(ArrayList.java:507)
at java.util.ArrayList.get(ArrayList.java:324)
at com.jme.scene.model.XMLparser.KeyframeController.update(KeyframeController.java:125)
at com.jme.scene.Spatial.updateWorldData(Spatial.java:352)
at com.jme.scene.Node.updateWorldData(Node.java:201)
at com.jme.scene.Spatial.updateGeometricState(Spatial.java:332)
at com.jme.scene.Node.updateWorldData(Node.java:206)
at com.jme.scene.Spatial.updateGeometricState(Spatial.java:332)
at com.jme.app.SimpleGame.initGame(SimpleGame.java:263)
at com.jme.app.BaseGame.start(BaseGame.java:63)
at com.volatile7.xv.ConvertMd2XML.main(ConvertMd2XML.java:86)
if I set keyframes, it works fine, but the selection doesn't happen. it just loops like a normal animation.
Any thoughts?[/code]