How to play animation without looping?

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
NZx

How to play animation without looping?

Post by NZx »

I loaded a .x mesh and I can find only 'setFrameLoop' function that can set range of animation.
but I do the animation loop forever,
how can I set it do just only 1 time?
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

I think if you search the forums, electron posted something about it a bit ago, I think it involved call back functions, but I may be wrong, but I'm pretty sure it was something to do with controlling character animation...
NZx

Post by NZx »

Thanks cartoonit.
Here, the link if anyone want to the same,
http://irrlicht.sourceforge.net/phpBB2/ ... php?t=2511

anyway, I really don't want to re-complie the engine.
if anyone could figure out another way of doing this, please tell me.
brcolow
Posts: 56
Joined: Mon Jul 19, 2004 6:15 am
Location: Arizona

Post by brcolow »

Basically you want to loop it once, correct? Then you can do this:

for (int i = 0; weaponNode->getFrameNr() < weaponNode->TotalFrames(); i++)
{
weaponNode->setCurrentFrame(i);
}

TotalFrames isn't a real function in Irrlicht, I'm too lazy to look at the docs, but there you go :)
G'Day.
eXodus
Posts: 320
Joined: Tue Jan 04, 2005 10:07 am
Location: Canada
Contact:

Post by eXodus »

Wouldn't this lock everything in the scene until the animation is finished?
brc_notlogged

Post by brc_notlogged »

Hmm.. I guess your correct...unless it's implemented inside the main game loop =\.
cartoonit
Posts: 286
Joined: Mon Nov 15, 2004 6:36 pm

Post by cartoonit »

Even if its implemented in the main game loop it would still play all the animation, just change for the update and recompile the engine, it is the simplist way....
NZx

Post by NZx »

Thanks everyone.
I think I have to recompile the engine to do it :l
Kaeles
Posts: 37
Joined: Thu Jun 03, 2004 12:43 am
Location: oklahoma
Contact:

Post by Kaeles »

why not just make a new int outside like startframe = -1;
endframe = "whatever frame it stops on " say 100
like niko does with the FPS counter in many examples
increment inside the main loop, and just call the
if(startframe < endframe)
setframeloop(frame)
startframe ++;
then you could reset the start frame with an event from the keyboard?
like onevent(key_forward)
startframe = 0;
inside the main drawing loop?

that would make it where each frame is played once a frame right?
then again, i havent slept... so this might not be readable... yea...
eXodus
Posts: 320
Joined: Tue Jan 04, 2005 10:07 am
Location: Canada
Contact:

Post by eXodus »

Don't start implementing every animation in the render loop. This will become really ugly with 2 or more animations...
Post Reply