`GetTransformAtTime` of a `SplineComponent` seems not linear...

Hi guys,

I’m making a chain in BP with a SplineComponent, my logic is like this:

1, first define a user-variable named float chainNodeHeight, and then convert it into spline time: float step = chainNodeHeight / GetSplineLength.
2, ForLoop to create chain node with the curTime beginning from 0 increased with step step
3, call GetTransformAtTime with this curTime to get location etc.

and the problem emerges:

this fixed step seems not suitable for a curved spline, check this pic out:


when the spline is relatively horizontal, the result is good,


but if the spline is very steep, the step looks a little big to march…

because I use curTime <= 1 as the condition for the ForLoop, so I think i can’t use the way accumulating on the lastNodePosition to create, this way I would not know when should i end the loop.

so is there a way to fix this problem? thanks guys.

well, i found the solution myself, it seems that sample the spline with time the result won’t be linear value (not sure if this is right, can’t find anything from the doc) as you can see in the pic above.
i modified my logic as:
1, use the curTime to limit the loop times still
2, use curTime * SplineLength to get the current distance, and use this distance to sample the spline to get location / rotation, and the results are finally correct now:


(sorry texture memory warns you know)


actually at some point the result is not very accurate but well i understand and it can be accepted.