Hello,

I use the formula from http://cubic.org/docs/hermite.htm for calculating a spline.

Now I want to move a model along the spline but with constant speed.

The user set the waypoints so i cant place them in the same distance.
This is the problem- if the waypoints have a higher distance between each waypoint, the model moves faster along the spline.


I have the circa length of the curve.
I go through the curve in 100 steps and save the length between each point on the curve.

The range of the curve is between 0.0 and 1.0 .

How can I calculate the right value between 0.0 and 1.0
in relation to the speed?

I tried some things:

Code:
var dist += 1 / curveLength * speed * time_step

spline(ent.x, dist);



Code:
spline(nextpoint.x,dist);

while(vec_dist(ent.x,nextpoint.x) > 0)
{
  c_move(...); // speed * time_step
}

dist += 0.1



and some other ways.

But they dont work.
The speed is not constant and/or the entity dont move
not exactly along the spline.

Google shows me some article about this topic
but there are no real examples, only complicate formulas
that i dont understand.

I hope somebody have a tip for me.

Good evening laugh

Last edited by Bone; 01/14/12 11:54.