Switchable Looping of the FollowSpline Animator

Discuss about anything related to the Irrlicht Engine, or read announcements about any significant features or usage changes.
Post Reply
rooly
Posts: 224
Joined: Tue Oct 25, 2005 4:32 pm
Location: Louisiana, USA, backwater country
Contact:

Switchable Looping of the FollowSpline Animator

Post by rooly »

I've been looking at the irrlicht source, and i've noticed that the spline-animator has no constraints as to beginning or end. When it finishes one pass, it starts again at the beginning. I'm just wondering how hard it would honestly be to modify the source with a "..., bool loop = true);". i can't do it myself, atm, because i'm not versed enough with irrlicht internals. wouldn't this also make the followspline animator much easier to use? once it's arrived at its final destination, it won't jump back to the beginning, (or even if it doesn't jump but continues following a spline to the beginning point) this should be easily implementable from what i've seen. the only problem arises from api-breaking changes of a very difficult function that at the moment needs exact timing to use.

Wasn't sure where to put this, since there's no "feature requests" forum.
When banks compete, you win.
When ISPs compete, you win.
When electronics retailers compete, you win.
When governments compete...you get drafted.
ikam
Posts: 46
Joined: Sun Jun 24, 2007 4:46 pm
Location: France

Post by ikam »

I think it's possible by modifying the CSceneNodeAnimatorFollowSpline like this :

- add 2 boolean data in the class definition. One for indicate that the first loop is passed (loopAgain) and the other to ask the user if we want to stop after the first loop (mLoop).
- initialise the booleans in the constructor. loopAgain = true; and mLoop = value passed by the constructor.
- at the begining of the "clamp" function add a test like this :

Code: Select all

if(idx>= size+1 && mLoop)
	{
		loopAgain = false;
	}
- add a test on the loopagain boolean before to execute code in the animateNode function.
Post Reply