[SOLVED] I may only run one out of 3 animations in JME

hey there, im using 3ds max 9 and the Ogre3D exporter to get my beloved ‘bubblehead’-avatar into JME 3 (newest version inc. updates).

I created 3 animations with biped: stand, walk and jump in 3ds and exported them via ogre to load them into JME. I’m currently using the ‘Hello Animation’ code https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:beginner:hello_animation to test things out but i can only run 1 animation.

how i do it atm:

  1. in 3ds max i open up my file and load the .bip animation onto my model.
  2. I use the ogre exporter, select my 3 animations to be exported.

    3)Now I copy the material,mesh and skelett in my JME direktion and change the directories in JME so thei point to my exported files.





    When i run my file now my ‘bubblehead’ is just jumping… whatever i do i dont get him to enter the ‘walk’ or ‘stand’ animation.

    I have already found out, that the animation hes stuck into is always the last one i loaded(like in step 1).



    please help bubblehead to walk and jump :frowning:



    TaiTen



    PS: my code:[java]package jme3test.helloworld;



    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.input.KeyInput;

    import com.jme3.input.controls.ActionListener;

    import com.jme3.input.controls.KeyTrigger;

    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;

    Node player;

    public static void main(String[] args) {

    HelloAnimation app = new HelloAnimation();

    app.setShowSettings(false);

    app.start();

    }



    @Override

    public void simpleInitApp() {

    viewPort.setBackgroundColor(ColorRGBA.LightGray);

    initKeys();

    DirectionalLight dl = new DirectionalLight();

    dl.setDirection(new Vector3f(-0.1f, -1f, -1).normalizeLocal());

    rootNode.addLight(dl);

    player = (Node) assetManager.loadModel("Models/bip/bip.mesh.xml");

    player.setLocalScale(0.05f);

    rootNode.attachChild(player);

    control = player.getControl(AnimControl.class);

    control.addListener(this);

    channel = control.createChannel();

    channel.setAnim("stand");

    }



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

    if (animName.equals("jump")) {

    channel.setAnim("stand", 1.50f);

    channel.setLoopMode(LoopMode.Loop);//(LoopMode.DontLoop) um die Animation nicht in einer schleife, also nur 1 mal abzuspielen

    channel.setSpeed(10f);

    }

    }



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

    // unused

    }



    /
    * Custom Keybinding: Map named actions to inputs. */

    private void initKeys() {

    inputManager.addMapping("jump", new KeyTrigger(KeyInput.KEY_SPACE));

    inputManager.addListener(actionListener, "jump");

    }

    private ActionListener actionListener = new ActionListener() {

    public void onAction(String name, boolean keyPressed, float tpf) {

    if (name.equals("jump") && !keyPressed) {

    if (!channel.getAnimationName().equals("jump")) {

    channel.setAnim("jump", 1.50f);

    channel.setLoopMode(LoopMode.Loop);

    }

    }

    }

    };

    }[/java]

Is animcycledone called at all if the animation is in loop mode? What happens if you set it to dontLoop?

1 Like

still jumping :confused:

i have thrown out all the “jump” and replaced them with “walk” but he seems to give a **** about what i write. He is jumping though “jump” is written nowhere in the code. It’s ‘just’ the first loaded animation to be exported from 3ds max.

checked whether the Ogre export correctly?



for example it do not override other animations winth jump animation ? (you can easly check it via SceneComposer)



it can be issue with export configuration imo.

1 Like

well i checked the ‘bip.skeleton.xml’ file to make sure all 3 animations are exported. they are at least named in there. What do you suggest to check it?

when you open model in SceneComposer → AnimControl and there it will work wrong, then it is export issue.



edit:



in old blender .49 was similar exporter to 3DS.

have you set good frames for EACH animation? (because on screenshot i dont see animations configuration)



for example jump: 0-10, walk: 11-20, etc…

1 Like

not sure what you want me to do (newb here :confused: )



all i can do with ‘AnimControl’ is to right click it and choose delete

SDK → Window → Properties.



then SceneComposer → Select AnimControl → in Properties window select animations and see how works.



you need this window to operate on it :wink:



and read my edit because it can be issue:

in old blender .49 was similar exporter to 3DS.
have you set good frames for EACH animation? (because on screenshot i dont see animations configuration)

for example jump: 0-10, walk: 11-20, etc...
1 Like

aaaaaahh. now i think i got the problem. I did 1 .bip file for each. If i understand your edit right i make 1 animation(like 100frames) in this animation i tell ‘bubblehead’ to walk for one walk-cycle(40frames), make a short break and idle in ‘stand’-mode(20 frames) and finish with a jump(40 frames). If i’d klick run bubblehead’ would do a sequence of all animations I’m about to export. next i go into the ogre-exporter and tell him that the animation ‘walk’ is frame 0-40, stand 41-60 and jump 61-100. I’ll try and let you know :slight_smile:


@oxplay2 said:
SDK -> Window -> Properties.

then SceneComposer -> Select AnimControl -> in Properties window select animations and see how works.

you need this window to operate on it ;)


nice to know that one ,too. thx!
1 Like

yeah, exacly.



that is why i like new blender and NLA system :slight_smile: i don’t need to set start and end frame for each animation.



it’s very hard when you have many objects and you need to set the same animations to all of them. but i hope you will no need to do that for so many objects



edit:

if you are not so much experienced with 3DS i propose you to use Blender(better ogre export + JME blend2j3o + more people use it here) :wink:

1 Like

http://1.bp.blogspot.com/-CVAYBAfu3pY/TVgj0ZGZtFI/AAAAAAAABO4/ZBzDgyrzTKM/s1600/success_baby.jpg

IT WORKED



oxplay2, you rock! thanks a lot!

1 Like

haha :smiley:



i love such images in the ending posts.



edit:

if you can, add [SOLVED] to topic name, to make this forum more “clean” :slight_smile:

1 Like