So this is the source code of my animation class :
[java]
/*
- To change this template, choose Tools | Templates
- and open the template in the editor.
*/
package Animations;
/**
*
-
@author Mathieu
*/
import com.jme3.animation.AnimChannel;
import com.jme3.animation.AnimControl;
import com.jme3.animation.AnimEventListener;
import com.jme3.animation.LoopMode;
import com.jme3.asset.AssetManager;
import com.jme3.math.Quaternion;
import com.jme3.math.Vector3f;
import com.jme3.scene.Node;
import com.jme3.scene.Spatial;
public class Animation {
private AnimChannel channel;
private AnimControl control;
private Spatial player;
Listener lis = new Listener();
public Animation( AssetManager asset, Node node ) {
player = asset.loadModel(“Models/Oto/Oto.mesh.xml”);
player.center();
player.setLocalScale(0.5f);
node.attachChild(player);
control = player.getControl(AnimControl.class);
control.addListener(new Listener());
channel = control.createChannel();
channel.setAnim(“Walk”);
}
private class Listener implements AnimEventListener {
public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {
if (animName.equals(“Walk”)) {
channel.setAnim(“Walk”, 0.50f);
channel.setLoopMode(LoopMode.Cycle);
channel.setSpeed(1f);
}
}
public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {
}
}
public void setPosition(Vector3f pos) {
player.setLocalTranslation(pos);
} public void setRotation(float rot) { Quaternion temp = new Quaternion(); temp.lookAt(new Vector3f(rot,0,0), new Vector3f(0,0,0)); player.setLocalRotation(temp); }
public void setAnimation(String ani) { channel.setAnim(ani); }
public Vector3f getScale() { return player.getLocalScale(); }
public String getAnimOn() { return channel.getAnimationName(); }
}
[/java]
When i run it in jMonkey engine it works but when i run it in the .exe file that jmonkey create for me or the jar file, a black window appear for a sec then it quit. I don’t know whats wrong with my animation code but i know it is in the animation code that it make the game crash
Thanks