Hey Guys,
I tried to work a bit with animations and currently have a little problem. I have my code here:
package mygame;
import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.AnimEventListener;
import com.jme3.animation.LoopMode;
import com.jme3.app.SimpleApplication;
import com.jme3.light.DirectionalLight;
import com.jme3.math.ColorRGBA;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
/** Sample 7 - how to load an OgreXML model and play an animation,
* using channels, a controller, and an AnimEventListener. */
public class HelloAnimation extends SimpleApplication
implements AnimEventListener {
private AnimChannel channel;
private AnimControl control;
public static void main(String[] args) {
HelloAnimation app = new HelloAnimation();
app.start();
}
@Override
public void simpleInitApp() {
viewPort.setBackgroundColor(ColorRGBA.LightGray);
DirectionalLight dl = new DirectionalLight();
dl.setDirection(new Vector3f(-0.1f, -1f, -1).normalizeLocal());
rootNode.addLight(dl);
Node player = (Node) assetManager.loadModel("Charakters/Archer/Movements/Walking/Walking.j3o");
player.setLocalScale(0.05f);
rootNode.attachChild(player);
control = new AnimControl();
player.addControl(control);
control.addListener(this);
channel = control.createChannel();
channel.setAnim("Armature");
channel.setLoopMode(LoopMode.Loop);
}
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {/*unused*/}
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {/*unused*/}
}
When I run the programm I get the following error:
SCHWERWIEGEND: Uncaught exception thrown in Thread[LWJGL Renderer Thread,5,main]
java.lang.IllegalArgumentException: Cannot find animation named: 'Armature/AnimControl/Armature'
at com.jme3.animation.AnimChannel.setAnim(AnimChannel.java:252)
at com.jme3.animation.AnimChannel.setAnim(AnimChannel.java:286)
at mygame.HelloAnimation.simpleInitApp(HelloAnimation.java:45)
at com.jme3.app.SimpleApplication.initialize(SimpleApplication.java:226)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.initInThread(LwjglAbstractDisplay.java:130)
at com.jme3.system.lwjgl.LwjglAbstractDisplay.run(LwjglAbstractDisplay.java:207)
at java.lang.Thread.run(Thread.java:748)
Soo he finds the file - its a blender file converted to j3o without any mistake, but he cannot find the animation. In Blender the Animation is called “Armature” so the same name. I have no clue why he cannot find it. I tried to export it to a mesh.xml yet but then I have another problem. I found a tutorial on this topic [Tutorial] Animation Workflow and Auto-Rigging Tools and did everything but in the last step - animation - its just not working…