Page 1 of 1

Frame End

Posted: Mon Sep 29, 2008 1:23 am
by Taymo
Whats the best way to check for the end of an animation cycle, without the animation callback. I thought I asked this before for Irrlicht and so I searched my post but couldn't find it. PHPBB's search is rubbish also.

Posted: Mon Sep 29, 2008 7:15 pm
by Taymo
Bump. Is this question too stupid to answer? There's gotta be something simple I'm missing..

Re: Frame End

Posted: Mon Sep 29, 2008 8:16 pm
by Acki
Taymo wrote:Whats the best way to check for the end of an animation cycle, without the animation callback.
I doubt there is a way...
maybe you can do something with IAnimatedMeshSceneNode::getFrameNr() ??? ;)

Posted: Mon Sep 29, 2008 8:18 pm
by B@z
hi
i dont know whats is correct, but i do this way:
first, set the animation to not loop.
then you have two functions:
node->getFrameNr() -> gets the current frame
node->getEndFrame() -> gets the current animation loops last frame what you've set at node->setAnimationLoop
and just check if they're equal.
but remember it doesn't work if you set it to looping

Re: Frame End

Posted: Mon Sep 29, 2008 8:30 pm
by Taymo
Acki wrote:
Taymo wrote:Whats the best way to check for the end of an animation cycle, without the animation callback.
I doubt there is a way...
maybe you can do something with IAnimatedMeshSceneNode::getFrameNr() ??? ;)
That's the way I'm doing it now. I store animation cycles and check to see if the animation cycles end like B@z suggested, but I had set the loop mode to true, so I wasn't getting the numbers I need. This problem's solved. Thanks B@z and Acki.

Posted: Tue Sep 30, 2008 5:18 am
by B@z
well, it doesn't work with loop mode, but...
you can do this

if (node->getFrameNr() == node->getEndFrame())
{
node->setFrameLoop(node->getStartFrame(), node->getEndFrame());
// and doing the thingy you need to do at the end of animation
}

Posted: Wed Oct 01, 2008 2:02 am
by Taymo
B@z wrote:well, it doesn't work with loop mode, but...
you can do this

if (node->getFrameNr() == node->getEndFrame())
{
node->setFrameLoop(node->getStartFrame(), node->getEndFrame());
// and doing the thingy you need to do at the end of animation
}
Yep thanks. I bet an animation system with an editor would be a fun extension for Irrlicht to make. Hmmm..