Is anybody here? Jack?
Jack, I think you should include this guy's (http://wonderfl.net/c/hzfJ) math algorithm for a better motion guide and it's worth the investment for the way how your tolerance variable work. The less will have more of his effect which is more accurate and the bigger value it will have that elastic long curve. Because the problem with the standard curve of BezierPlugin is that it has real big tolerance to it so it doesn't really take the shortest direction but making a bigger curve then travel through the longer distance. Which is a big problem there.
Here's what I edited:
if (through) {
for (p in props) {
a = makeBezierArray (props[p]);
all[p] = b = [];
if (a.length > 3) {
b[b.length] = [a[0], a[1], (a[1] + a[2]) / 2];
for (i = 2; i < a.length - 2; i++) {
b[b.length] = [b[i - 2][2], a[i], (a[i] + a[i + 1]) / 2];
}
b[b.length] = [b[b.length - 1][2], a[a.length - 2], a[a.length - 1]];
} else if (a.length == 3) {
b[b.length] = [a[0], a[1], a[2]];
} else if (a.length == 2) {
b[b.length] = [a[0], (a[0] + a[1]) / 2, a[1]];
}
}
}
Add this function below:
public static function makeBezierArray(p0:Array):Array {
// make a copy you can mess with 1st
var p:Array = p0.concat ();
// extrapolate in some way
if (p.length < 2) {
p.unshift (p [0]);
p.push (p [p.length -1]);
} else {
p.unshift (p [0] - 0.5 * (p [1] - p [0]));
p.push (p [p.length -1] - 0.5 * (p [p.length -2] - p [p.length -1]));
}
var bezier:Array = [];
// convert all points between p[0] and p[last]
for (var i:int = 1; i < p.length -2; i++)
{
var b1:Number = -p[i -1]/6 +p[i] +p[i +1]/6;
var b2:Number = +p[i]/6 +p[i +1] -p[i +2]/6;
bezier.push (b1); bezier.push (b2);
}
return bezier;
}
You need to somehow integrate this with a new variable. I don't know what your tolerance variable really for there. Hope that helps. But if you still have the answer for my previous question - which is how to integrate this bezier curve to a library or stage object, that would be fantastic if possible. Cheers.