Skip to main content
added 106 characters in body
Source Link
Aequitas
  • 83
  • 1
  • 7

I encountered similar issues while attempting to solve this for a Catmull-Rom spline without access to the source code in to fetch the coefficient derivatives.

My spline was based on time parameters of 0 - 1000, but this could easily be adapted for 0 - 1.

Since the position and time do not have 1:1 ratio, tracking the difference in position of the next desired step and then adjusting the next time step accordingly gave me the uniform values I was looking for.

My basic approach was as follows:

        Vector nextPosition = spline.GetPointAtTime(mSplineTimesplineTime + 1);
        Vector positionDelta = (nextPosition - position);

        float distance = positionDelta.Magnitude();

        float ratio = 1 / distance;
        splineTime = splineTime + speed * ratio;

Where the speed is a some predefined constant. The object position is then set per frame by getting the amended spline time in the last line of the code.

I encountered similar issues while attempting to solve this for a Catmull-Rom spline without access to the source code in to fetch the coefficient derivatives.

My spline was based on time parameters of 0 - 1000, but this could easily be adapted for 0 - 1.

Since the position and time do not have 1:1 ratio, tracking the difference in position of the next desired step and then adjusting the next time step accordingly gave me the uniform values I was looking for.

My basic approach was as follows:

        Vector nextPosition = spline.GetPointAtTime(mSplineTime + 1);
        Vector positionDelta = (nextPosition - position);

        float distance = positionDelta.Magnitude();

        float ratio = 1 / distance;
        splineTime = splineTime + speed * ratio;

Where the speed is a some predefined constant.

I encountered similar issues while attempting to solve this for a Catmull-Rom spline without access to the source code in to fetch the coefficient derivatives.

My spline was based on time parameters of 0 - 1000, but this could easily be adapted for 0 - 1.

Since the position and time do not have 1:1 ratio, tracking the difference in position of the next desired step and then adjusting the next time step accordingly gave me the uniform values I was looking for.

My basic approach was as follows:

        Vector nextPosition = spline.GetPointAtTime(splineTime + 1);
        Vector positionDelta = (nextPosition - position);

        float distance = positionDelta.Magnitude();

        float ratio = 1 / distance;
        splineTime = splineTime + speed * ratio;

Where the speed is some predefined constant. The object position is then set per frame by getting the amended spline time in the last line of the code.

Source Link
Aequitas
  • 83
  • 1
  • 7

I encountered similar issues while attempting to solve this for a Catmull-Rom spline without access to the source code in to fetch the coefficient derivatives.

My spline was based on time parameters of 0 - 1000, but this could easily be adapted for 0 - 1.

Since the position and time do not have 1:1 ratio, tracking the difference in position of the next desired step and then adjusting the next time step accordingly gave me the uniform values I was looking for.

My basic approach was as follows:

        Vector nextPosition = spline.GetPointAtTime(mSplineTime + 1);
        Vector positionDelta = (nextPosition - position);

        float distance = positionDelta.Magnitude();

        float ratio = 1 / distance;
        splineTime = splineTime + speed * ratio;

Where the speed is a some predefined constant.