I’ve seen and read a lot of threads concerning iTween and traversing through paths at a constant speed. I have an example up and running right now that works perfectly, moving all objects around a curve at a constant rate.
The path in question is a flat oval (Much like a running track). For an object placed directly on a path, this works perfectly. I can have it move at, say, 15 units per second and it’ll do that.
However, when I incorporate an offset with the curve, all objects sitting on the offset complete the curve in the same amount of time, because the math is tied to a time and not a speed in reality. It simply takes the speed and divides it by the length of the base curve and multiplies that by delta time. So although it purports to operate at a consistent speed, this is not quite true.
I know this because if I change the path length math to update the length in the equation based on the offset, it operates perfectly as a state function, but not in between start and end. As in; when a full revolution is complete, all of the objects are where they should be. But the spaces between them occur over the course of the run.
This should not be happening. The advances in spacing should technically only occur on the curves of the oval and not the straight sides, because when they are all moving at the ‘same speed’ in a straight line, no advances should be made.
I don’t quite know how to deal with this. The code I borrowed from another thread works mainly with iTween Path Length and PutOnPoint functions.
I’ve gotten as far as calculating the maximum number of units an object should be able to travel in a given FixedUpdate. The next step should be to find what point on the curve from the current point is that number of units away. I am versed in calculus and am not afraid to use it but I am not quite sure about how to construct an algorithm to represent the curve.
Any help would be appreciated.
TL;DR: I want to move something along a curve in a way that keeps it at a steady units/second, taking into account any offset from the curve.
Thanks! - YA