- Home /
Spline off center using iTween
Hi,
I hope I get this described without leaving open questions. I am using iTween to generate/update my path (during runtime) and move my asset along this by getting iTween.PointOnPath() and setting it to the calculated position. This is working as intended.
My problem is, that when my path changes from straight into a curve it does a slight bend to the opposite direction (please take a look at the image / red arrow), which in my case is neither desired nor suitable.
Is there a proper way to tell iTween which nodes should just be connected linear? I made a loot of searching in iTween doc/Google etc but found nothing.
Any help/tip would be highly appreciated.
Regards,
Torsten
Answer by Julien-Lynge · Jan 30, 2013 at 07:31 PM
Unfortunately, there is no way to do what you're describing with iTween (without modifying it). I believe you're thinking of bezier curves when you say you want a 'straight node' - iTween uses Catmull-Rom splines, not bezier. The Catmull-Rom algorithm doesn't allow this.
One feature of the algorithm is that it passes through all defined points, so if you want a closer match to the curve you could simply add more points. The more you add, the closer it'll follow the track, within the limits of the algorithm.
Answer by TorstenH · Jan 31, 2013 at 08:18 AM
hmm... ok haven't taken this into account. Thx for the answer, guess I need to look at other tools then.