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

**URL:** <https://forums.unrealengine.com/t/gettransformattime-of-a-splinecomponent-seems-not-linear/688415>\
**Category:** International\
**Tags:** splinecomponent, unreal-engine, UE5-0, question\
**Created:** [November 11, 2022, 4:50am UTC](https://forums.unrealengine.com/t/gettransformattime-of-a-splinecomponent-seems-not-linear/688415 "2022-11-11T04:50:13Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bobbmer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bobbmer](https://forums.unrealengine.com/u/Bobbmer)\
**Post date:** [November 11, 2022, 4:50am UTC](https://forums.unrealengine.com/t/gettransformattime-of-a-splinecomponent-seems-not-linear/688415/1 "2022-11-11T04:50:14Z")

</div>

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:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/e/3/c/e3c3a5544c5f157634ff1a5f35ea05b7f3bfaed5.jpeg)  
when the spline is relatively horizontal, the result is good,

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/9/e/1/9e1ffb6f507abedd21f0eb7b0776f911de0178e2.jpeg)  
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.

---

<div class="post-metadata">

**Author:** ![Bobbmer](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Bobbmer](https://forums.unrealengine.com/u/Bobbmer)\
**Post date:** [November 11, 2022, 10:01am UTC](https://forums.unrealengine.com/t/gettransformattime-of-a-splinecomponent-seems-not-linear/688415/2 "2022-11-11T10:01:39Z")

</div>

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:

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/3/5/2/352dfed6efa5fe04e89b59ab26fcecbdfc533339.jpeg)  
(sorry texture memory warns you know)

 ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/d/8/b/d8b97f4fffbb6516f5c73e501dcd6bdd20949259.jpeg)  
actually at some point the result is not very accurate but well i understand and it can be accepted.
