Movement and Animation

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
SilentScope2190
Posts: 5
Joined: Sun Jul 26, 2009 12:44 am

Movement and Animation

Post by SilentScope2190 »

first things first does anyone know how to call the animated sydney node when a key is pressed,I loaded the sydney mesh but its constantly playing.


second,i started going into collisions with the terrain i managed to collide my mesh using the camera like in the tutorial. does anyone know how to mix user control with the WASD keys and collison?Thanks.

[/code]
Last edited by SilentScope2190 on Sat Aug 01, 2009 1:55 am, edited 1 time in total.
Castaa
Posts: 39
Joined: Mon Jul 07, 2008 7:38 pm
Location: San Francisco
Contact:

Post by Castaa »

I'm actually looking for a similar answer. I would assume node->setAnimationSpeed(0); would stop the animation. node->setAnimationSpeed(4); would start it back up.

But that seems like a hack?
My game: Star Sonata
Star Sonata is a massively multiplayer space game.
instinct
Posts: 87
Joined: Sat May 10, 2008 3:42 pm

Post by instinct »

simply start the animation when u press a movement key and stop it when that key is released. See the documentation of the SEvent class ;)

sydney->setMD2Animation(EMAT_RUN);

Im not sure about the EMAT_RUN, but check your intellisense for the options ;)
B@z
Posts: 876
Joined: Thu Jan 31, 2008 5:05 pm
Location: Hungary

Post by B@z »

as for me, i always save two variables. one the currentAnim, what i override at every frame, and one the previous animation.

so

Code: Select all

enum PLAYER_ANIMATION
{
 PA_STAND,
 PA_WALK,
 PA_RUN
 // etc
};

int pAnim, cAnim;

then in the control loop

cAnim = PA_STAND;

if (up && !shift)
 cAnim = PA_WALK
else if (up)
 cAnim = PA_RUN;

// etc

if (cAnim != pAnim)
 node->setAnimation(/*the frames, for me, i have them it in an array*/anims[cAnim][0], anims[cAnim][1]);
pAnim = cAnim;
note that i just wrote this from my head, maybe there are typos or something...
and u have to do the keyboard checking etc by yourself, im just giving an example for u.
Image
Image
Post Reply