Your problem is that you are using t
and moving the time forward, in a parametric equation t
represents any varying quantity and that doesn't strictly mean you should move the time forward. This can be simply achieved by writing an interpolation in a loop and increment t
just at initialization time.
// call this at initialization time
int stepsCount = 10; // Change depending on the object count, assuming 10 objects here
float step = 1.0f/(float)stepsCount;
float t = 0.0f;
for (int i=0; i < stepsCount; i++, t+=step)
{
// depending on your interpolation equation, just pass t as a param
objectPos[i] = Interpolate( initPos, finatP, t);
}
This will set the position for each object depending on t, the first object when t=0
will be at initPos, and when t=1
the final object will be at the finalPos. In case you don't want the objects to span the whole interval, we need to scale the step
accordingly.
// This is one way to do it
float step = 1.0f/(float)stepsCount;
step *= scaleFactor;
scaleFactor = 0.5
will take half the interval. In case you want to determine the scaleFactor base on some position, you need to calculate it by taking the inverse interpolation, in other words you need to get the parametric quantity
that represents that position on the line/curve.