Can CSceneNodeAnimatorFollowSpline be set to not 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
pir
Posts: 24
Joined: Wed Apr 29, 2009 8:15 pm

Can CSceneNodeAnimatorFollowSpline be set to not looping?

Post by pir »

I want to use CSceneNodeAnimatorFollowSpline for animating my camera. But I don't want the animation to loop. Is there any way to know if the animation is finished so I can stop the animation?


BR
pir
CuteAlien
Admin
Posts: 9694
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Sorry, SceneNodeAnimatorFollowSpline misses a loop parameter so far. So for now you have to create your own animator. Just copy CSceneNodeAnimatorFollowSpline.cpp and .h rename the classes for a start.

Then derive your animator from ISceneNodeAnimatorFinishing instead of ISceneNodeAnimator.

And in animateNode you should probably change that line:

Code: Select all

const s32 idx = core::floor32( dt ) % pSize;
in something like that (untested):

Code: Select all

const s32 idx = core::floor32( dt );
if ( idx >= pSize )
{
    HasFinished = true;
    node->setPosition(Points[pSize-1]);
    return;
}
If you add this to the feature-tracker you increase the chance that we think of adding this to the engine.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
pir
Posts: 24
Joined: Wed Apr 29, 2009 8:15 pm

Post by pir »

thanks! I did as you said and derived a own Animator class. It works fine.
Virion
Competition winner
Posts: 2148
Joined: Mon Dec 18, 2006 5:04 am

Post by Virion »

has this been added to the engine yet?
CuteAlien
Admin
Posts: 9694
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

No, not yet.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
CuteAlien
Admin
Posts: 9694
Joined: Mon Mar 06, 2006 2:25 pm
Location: Tübingen, Germany
Contact:

Post by CuteAlien »

Loop and pingpong have noow been added to svn trunk and will be in Irrlicht 1.7.
IRC: #irrlicht on irc.libera.chat
Code snippet repository: https://github.com/mzeilfelder/irr-playground-micha
Free racer made with Irrlicht: http://www.irrgheist.com/hcraftsource.htm
Post Reply