Animation Problem

So this is the source code of my animation class :



  • 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”);;



    control = player.getControl(AnimControl.class);

    control.addListener(new Listener());

    channel = control.createChannel();



    private class Listener implements AnimEventListener {

    public void onAnimCycleDone(AnimControl control, AnimChannel channel, String animName) {

    if (animName.equals(“Walk”)) {

    channel.setAnim(“Walk”, 0.50f);





    public void onAnimChange(AnimControl control, AnimChannel channel, String animName) {



    public void setPosition(Vector3f 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(); }



    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 :slight_smile:

Check the logs for a stack trace.

Can it check the logs if i run the game out of jmonkey?

If you write the logs to a file, or attach a console, or whatever. Google viewing logs in java applications to see loads of options.

try running from the command line, like :

[xml]java -jar “mygame.jar”[/xml]

it should show up some errors we can help you debug. (or it may show you that it cant find “Models/Oto/Oto.mesh.xml” and you might fix it on your own ??)

… note to self: don’t start writing replies, then play a game of starcraft, then finish reply without checking thread :wink:

@thetoucher said:
... note to self: don't start writing replies, then play a game of starcraft, then finish reply without checking thread ;)


I didnt start playing star craft i started playing wow


o and btw windows do not recognise the function java

Add java to the command line path.

Ok thanks, i see, it doesnt find the model, but why? in jMonkeyEngine it finds it but not the .exe file or jar file?

wait nvm, i fixed it but last question : why when i compile the project jmonkey doesnt copy the model oto.mesh.xml? it only copy the oto.j3o?

Read the hello assets tutorial, it’s covered in there (or at least one of the early tutorials, I think that one).