In my blueprint I am trying to create a Spline Mesh Component along a fragment of a spline.
For the sake of simplicity, let us assume that spline S(t) is defined only by endpoint locations and tangents. Given values p,q such that 0 < p < q < 1 we are trying to create a spline mesh between points S(p)…S(q).
My first approach is to simply take locations and tangents at the p and q values. However, the magnitude of tangents seems to be off, and the shape of the mesh does not match the shape of the spline. Tangents need to be scaled down by some factor, but I don’t know how to compute this. What is the formula? Any hints to how to set it right? What kind of mathematical spline is actually behind the UE spline?
My current blueprint (simplified to reflect only the problem at hand) looks like this:
For testing purpose I use it with SM_Castle_StoneTrim_500x100 which is a trim with high polygon count which bends nicely with the spline. With the values from=0, to=1 the shape of the generated mesh fits the spline perfectly:
However, when I set from=0.2 and to=0.7 I get something like this:
Clearly, start and end points are correct. The direction of tangents is OK too. The problem is their magnitude.
As an experiment I tried to scale down the tangents by the portion of spline that it is actually used by (in this case, it would be 0.5). It is a bit better, but not correct either.
I could now continue trying some random values and expressions, but that would be going in the dark, hoping to find a solution by accident. I would prefer to have a solid mathematical foundation for this instead.