# The motion of the object along the spline is not perfect

**URL:** <https://forums.unrealengine.com/t/the-motion-of-the-object-along-the-spline-is-not-perfect/1619659>\
**Category:** Programming & Scripting\
**Tags:** unreal-engine, transform, Spline, question, Blueprint\
**Created:** [January 16, 2024, 6:29pm UTC](https://forums.unrealengine.com/t/the-motion-of-the-object-along-the-spline-is-not-perfect/1619659 "2024-01-16T18:29:41Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![mykola](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@mykola](https://forums.unrealengine.com/u/mykola)\
**Post date:** [January 16, 2024, 6:29pm UTC](https://forums.unrealengine.com/t/the-motion-of-the-object-along-the-spline-is-not-perfect/1619659/1 "2024-01-16T18:29:41Z")

</div>

I have a road for roller coaster and a car that should repeat the motion of the spline, but if the road is correctly built, but the turns of the car is far from ideal.

 ![Screenshot 2024-01-16 181926](https://d3kjluh73b9h9o.cloudfront.net/original/4X/6/b/6/6b6ab37e567e266e6c2b857d07765015c1a73cf1.jpeg)  
 ![Screenshot 2024-01-16 181956](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/3/2/23216d6c9c8554f70e8e265f243e86f4fb392558.jpeg)

I’ve tried doing it in the BP editor using TimeLine and Get Transform at Distance Along Sline, and I’ve also tried Event Tick.

> **BP\_Cart Event Tick**
>
> ![image](https://d3kjluh73b9h9o.cloudfront.net/original/4X/1/5/2/152787c48e4b3bb2f46070dcbb32226c67065f03.png)

Since I’m making a road with the help of C++. I tried to use also FInterpCurveQuat and FInterpCurveVector, but it did not give any results, it moves badly too.

> **C++ try**
>
> ```CPP
> void ACartBase::Tick(float DeltaTime)
> {
> if (DistanceAlongSpline < MaxDistance - 1)
> {
> DistanceAlongSpline += DeltaTime * Speed;
> 
> const FInterpCurveQuat SplineRotation = NL2_Track->Spline->GetSplinePointsRotation();
> const FInterpCurvePoint<UE::Math::TQuat<double>> RotPoint = SplineRotation.Points[DistanceAlongSpline];
> 
> const FInterpCurveVector SplineLocation = NL2_Track->Spline->GetSplinePointsPosition();
> const FInterpCurvePoint<UE::Math::TVector<double>> PosPoint = SplineLocation.Points[DistanceAlongSpline];
> 
> const FTransform Transform = FTransform(RotPoint.OutVal, FVector(PosPoint.OutVal), FVector{1.0f, 1.0f, 1.0f});
> 
> Mesh->SetWorldTransform(Transform);
> }
> 
> Super::Tick(DeltaTime);
> }
> 
> ```

What am I doing wrong?
