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

Bobbmer
Fri, 11 Nov 2022 04:50:13 +0000
International

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.

2 posts - 1 participant