Hi Gio, need some advice.
I make the object move along a curve (in my case, Bezier).
According to the curve formula
//P = (1−t)3P1 + 3(1−t)2tP2 +3(1−t)t2P3 + t3P4
I set coordinates for x and y and then set is a position of my object, Something like:
obj.onUpdate = function(){
t+=.005;
x = ...//according formula
y = ...//according formula
obj.setRotation(Math.atan(dy/dx));//according formula
obj.setPosition(x,y);
}
But I noticed that such a movement with linearly varying time has different speeds in different parts of the curve.
This is clearly visible if you attach several more objects and move them together like a train. The distance between segments changes on different sections of the curve.
I searched the Internet for solutions and it is logical of course that I found solutions for c++ and C# the essence of which is to divide the curve into points and then linear movement from point to point.
I see the solution as splitting the curve into a set of points and then using a bundle wade.sceneObject().moveTo() and wade.sceneObject.onMoveComplete() to move the object, but for some reason I don't like the solution (I didn't even do it)
I know that Gio is strong in mathematics and may have encountered similar things.
And of course it is worth noting that wade has no functions for working with curves. I think this is missing functionality