# moving linearly along a bezier curve

Ok so I had an idea for a way of moving linearly along a Bezier curve.
I thought that if you plot a graph (in real life) that compares the value of t to the actual length you are along the curve, you could move linearly along the curve.
For example, lets say I had a cubic Bezier curve that was 10 units long. Now if I increase t every frame by 0.01, I would end up with non-linear movement (it would move quicker at some parts of the curve than others.) So if I plotted a graph, every 0.01t along the curve, that returns the distance I am along the curve, I could feed in a distance, and get back a value of t.
That means that to move linearly, I would increase the distance every frame, return a value of t, and then move to that value of t. Linear movement!
Only problem is, lets say I am at a distance that wasn’t sampled on the graph, how would I get a t value? sort of like interpolated between the points?
Its a tricky idea, and I’m sure there are a lot of reasons why this idea is flawed, but so far it seems like the only solution you really have.
The only solution I could think of is sampling the curve at ridiculous resolution, ie every 0.001t, and then round the distance to one that is sampled at this t value. however that means that things will jump along the curve. but its the only solution so hey ho.

You’re on the right track.

To take a note from a great source on Bezier curve information,

there is no generic formula that
allows you to calculate the arc
length.

With this in mind, a good enough approach is to break down the curve into points, whether at roughly-equidistant or arbitrary lengths, then interpolate between the nearest points on each side of your target.

Unfortunately, there is no inexpensive, perfect solution to this problem, but if perfection isn’t absolutely necessary, you can still get indistinguishably close through quicker calculations than you might expect.