[SOLVED]Md3 reset animation<<?

I’ve searched at the forum and i keep on stumbling on Md2KeyFrameSelector, my problem is, where do I find this “Md2KeyFrameSelector” ?



Though I use md3 for my game, iM still looking at this “Md2KeyFrameSelector”. Can somebody help me how to control my MD3 file?



My character stands then runs but the running cycle starts where I ended.



Stand > RUN(0, 1, 2, 3) > Stand > RUN( 3, 0 , 1, 2, 3, 0, 1) > Stand > RUN( 1, 2, 3 , 0)



I want my animation to start again at 0 but its not… Please help me… badly need it… :’(

Hmm,…didn't used md3 for quite a while now! I think you have to set the time like this:


md3controller.setNewAnimationTimes(0,3);



That might not work as the javadoc says time,...maybe you would have to do this
instead:

md3controller.setNewAnimationTimes(md3controller3.PointInTime.get(0).time,md3controller3.PointInTime.get(3).time);



I have no jme-installation around at the moment, so the code might differ a bit.

Also have a look here:
http://www.jmonkeyengine.com/doc/com/jmex/model/animation/KeyframeController.html#keyframes

and

http://code.google.com/p/jmonkeyengine/source/browse/trunk/src/jmetest/renderer/loader/TestMd2JmeWrite.java

EDIT: Oh I mistunderstood your question. I think to reset you might use

controller.setCurTime(0);


ttrocha said:

Hmm,...didn't used md3 for quite a while now! I think you have to set the time like this:

md3controller.setNewAnimationTimes(0,3);



That might not work as the javadoc says time,...maybe you would have to do this
instead:

md3controller.setNewAnimationTimes(md3controller3.PointInTime.get(0).time,md3controller3.PointInTime.get(3).time);



I have no jme-installation around at the moment, so the code might differ a bit.

Also have a look here:
http://www.jmonkeyengine.com/doc/com/jmex/model/animation/KeyframeController.html#keyframes

and

http://code.google.com/p/jmonkeyengine/source/browse/trunk/src/jmetest/renderer/loader/TestMd2JmeWrite.java

EDIT: Oh I mistunderstood your question. I think to reset you might use

controller.setCurTime(0);





Sorry, but iM really a total noob at jME... my current status is that i've created a collision, then loaded characters, walls, terrains... My problem right now is my animation... I can't seem to animate my character the way i wanted it to...

how do i use the KeyframeController.setCurTime() ????

I see this jmetest.renderer.loader.TestKeyframeController test file but I can't grasp the concept how to use it on my MD3 file... (I use MD3 because I can't seem to understand how to load MD5 file)

Here are my problem so far...

1. How to set my MD3 file to a specific keyframe.

2. Reset the animation of my MD3 file currently in my Spatial... ?? *I dont know if I should put my MD3 in a spatial or not...

3. How to be able to use Controller.RT_WRAP for my MD3 file... ??

Other problem/s that could also let me do animation
1. How do I convert my .max(3ds Max File) to .md5 or any format that I can easily do animation that I can easily control?

2. Sample codes and tutorial guides on how to use .md5 because I can't seem to find a straightforward answer...

Please do help me, my thesis project is currently running out of time... I hope to find answer soon... Thanks for the info @ttrocha... But I can't seem to find a straightforward answer to any of my problems...

Well,…you said you are playing your md3-file and it does not go back to the start. For that you need

the controller.



Here some commands you might use:


   KeyframeController controller = (KeyframeController)r.getController(0);
            // restrict the animation! don't know what exactly 0 and 10 is. You have to find out
            controller.setNewAnimationTimes(0,10);
            // set controller to 0
            controller.setCurTime(0);
           // start
           controller.setActive(true);
          // stop
           controller.setActive(false);
          // use wrap
          controller.setRepeatType(Controller.RT_WRAP);



Sry, have to go now!


ttrocha said:

Well,...you said you are playing your md3-file and it does not go back to the start. For that you need
the controller.

Here some commands you might use:

   KeyframeController controller = (KeyframeController)r.getController(0);
            // restrict the animation! don't know what exactly 0 and 10 is. You have to find out
            controller.setNewAnimationTimes(0,10);
            // set controller to 0
            controller.setCurTime(0);
           // start
           controller.setActive(true);
          // stop
           controller.setActive(false);
          // use wrap
          controller.setRepeatType(Controller.RT_WRAP);



Sry, have to go now!






I've solved the problem... I think I did... well the running animation resets to the old one if I dont press the "run" button... I've put this on my update method... so far this is a test... but iM already looking forward to it... ^_^
tanx for the time to read my posts... your concepts gave me an idea...

if (KeyBindingManager.getKeyBindingManager().isValidCommand("Run",true)){
player.detachChild(playerModel);
player.attachChild(playerModelRun);

// System.out.println();
player.updateRenderState();
        } else {
        ((KeyframeController)playerModelRun.getController(0)).setNewAnimationTimes(0,40);
        ((KeyframeController)playerModelRun.getController(1)).setNewAnimationTimes(0,40);
        ((KeyframeController)playerModelRun.getController(2)).setNewAnimationTimes(0,40);
        ((KeyframeController)playerModelRun.getController(3)).setNewAnimationTimes(0,40);
        ((KeyframeController)playerModelRun.getController(4)).setNewAnimationTimes(0,40);
        ((KeyframeController)playerModelRun.getController(5)).setNewAnimationTimes(0,40);
        player.detachChild(playerModelRun);
        player.attachChild(playerModel);
        }


what I did was I cast my Spatial.getController( i ) to KeyframeController then called the method setNewAnimationTimes so I can set it back to my previous animation procedure...

to get it properly working...


so I changed the simple logics to this... to get it properly working and can be dynamically changed...

float minTime = 0, maxTime = 40;
       
        for(int i = 0 ; i < playerModelRun.getControllerCount(); i++ ) {
        ((KeyframeController)playerModelRun.getController(i)).setNewAnimationTimes( minTime , maxTime );
        }
       
        player.detachChild(playerModelRun);
        player.attachChild(playerModel);


Whew! tanx again for ttrocha !! ^_^