Page 1 of 1

how to get full animation with 1 button press?

Posted: Tue Jun 22, 2004 7:55 am
by RizzleR
i'm using the following code

Code: Select all

if(KeyStates[EPA_ACTION_JUMP]) 
         
             { 
                if(State != EPS_JUMPING) 
                         { 
                           State = EPS_JUMPING; 
                           amNode->setMD2Animation(irr::scene::EMAT_JUMP); 
                         } 
			    

              }
EPA_ACTION_JUMP is mapped to spacebarkey
problem is i have to keep it pressed to play the whole animation
want it to get so that when i press the spacebar 1 time
it plays the animation 1 time

anybody got any clues?

Posted: Tue Jun 22, 2004 8:09 am
by Manakel
In your event when spacebar is pressed , turn on a BOOLEAN like bPlayAnimation=true.

and in you rendering, say if bPlayAnimation=true , set animation...
and toggle of bPlayAnimation


Quick and dirty idea , maybe not the best

Posted: Tue Jun 22, 2004 12:15 pm
by RizzleR
seeing the amount of buttons i'm using and how they are implemented
this solution probably isn't gonna work

Posted: Tue Jun 22, 2004 1:41 pm
by warui
Maybe problem is elsewhere ? I checkd setMD2Animation() and it takes aniamtion parameters from model (start frame, end frame and speed) and sets valuse for setAnimationSpeed() and setFrameLoop(). Maybe on releasing spacebar you set new FrameLoop and causes the problem.
I added node->setMD2Animation(EMAT_JUMP); to "hallo world" tutorial and it works perfectly fine.