Following USplineComponent path while ticking is pausing

I have a function (which is to be used in ticking) which returns where the new world position of an actor should be along the spline:

bool CalcPositionOnSpline(float DeltaTime, FVector CurrentPosition, FVector& NewPosition) {

   // Set new position
   float CoveredDistance = SplineComponent->GetDistanceAlongSplineAtLocation(CurrentPosition, ESplineCoordinateSpace::World);

   float TotalDistance = SplineComponent->GetSplineLength();
   float UpdatedDistance = CoveredDistance + (Speed * DeltaTime);
   NewPosition = SplineComponent->GetLocationAtDistanceAlongSpline(UpdatedDistance, ESplineCoordinateSpace::World);


   // Return if has reached end
   bool bHasReachedEnd = FMath::IsNearlyEqual(UpdatedDistance, TotalDistance);
   return bHasReachedEnd;

}

blueprintue for copying

but for some reason it gets stuck as such:

Can someone please tell me why this is happening and how do I fix it?
I’m using Engine version 5.4.4 btw


Edit:
I tried another spline shape and logged it’s error

If you check the below log it seems to be “minutely going back and forth” for some reason

(Speed is 100 for the below log)

Error log
[2025.10.13-22.22.02:588][215]LogTemp: Warning:  DeltaTime: 0.016741, CoveredDistance: 724.450195, UpdatedDistance: 726.124268, TotalDistance: 1639.336182, CurrentPosition: X=-545.873 Y=638.653 Z=-0.500, NewPosition: X=-545.748 Y=636.835 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:604][216]LogTemp: Warning:  DeltaTime: 0.016621, CoveredDistance: 726.267700, UpdatedDistance: 727.929810, TotalDistance: 1639.336182, CurrentPosition: X=-545.748 Y=636.835 Z=-0.500, NewPosition: X=-545.602 Y=634.873 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:621][217]LogTemp: Warning:  DeltaTime: 0.016900, CoveredDistance: 728.229614, UpdatedDistance: 729.919678, TotalDistance: 1639.336182, CurrentPosition: X=-545.602 Y=634.873 Z=-0.500, NewPosition: X=-545.431 Y=632.819 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:638][218]LogTemp: Warning:  DeltaTime: 0.016429, CoveredDistance: 730.284546, UpdatedDistance: 731.927490, TotalDistance: 1639.336182, CurrentPosition: X=-545.431 Y=632.819 Z=-0.500, NewPosition: X=-545.246 Y=630.881 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:654][219]LogTemp: Warning:  DeltaTime: 0.016588, CoveredDistance: 732.223389, UpdatedDistance: 733.882202, TotalDistance: 1639.336182, CurrentPosition: X=-545.246 Y=630.881 Z=-0.500, NewPosition: X=-545.050 Y=629.148 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:671][220]LogTemp: Warning:  DeltaTime: 0.016743, CoveredDistance: 733.960144, UpdatedDistance: 735.634460, TotalDistance: 1639.336182, CurrentPosition: X=-545.050 Y=629.148 Z=-0.500, NewPosition: X=-544.754 Y=627.049 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:687][221]LogTemp: Warning:  DeltaTime: 0.016581, CoveredDistance: 736.068848, UpdatedDistance: 737.726929, TotalDistance: 1639.336182, CurrentPosition: X=-544.754 Y=627.049 Z=-0.500, NewPosition: X=-544.294 Y=624.826 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:704][222]LogTemp: Warning:  DeltaTime: 0.017008, CoveredDistance: 738.322510, UpdatedDistance: 740.023315, TotalDistance: 1639.336182, CurrentPosition: X=-544.294 Y=624.826 Z=-0.500, NewPosition: X=-543.654 Y=623.284 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:721][223]LogTemp: Warning:  DeltaTime: 0.016382, CoveredDistance: 739.974365, UpdatedDistance: 741.612610, TotalDistance: 1639.336182, CurrentPosition: X=-543.654 Y=623.284 Z=-0.500, NewPosition: X=-542.836 Y=623.103 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:738][224]LogTemp: Warning:  DeltaTime: 0.016700, CoveredDistance: 740.782471, UpdatedDistance: 742.452393, TotalDistance: 1639.336182, CurrentPosition: X=-542.836 Y=623.103 Z=-0.500, NewPosition: X=-542.337 Y=623.687 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:754][225]LogTemp: Warning:  DeltaTime: 0.016658, CoveredDistance: 741.747253, UpdatedDistance: 743.413025, TotalDistance: 1639.336182, CurrentPosition: X=-542.337 Y=623.687 Z=-0.500, NewPosition: X=-541.806 Y=624.740 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:771][226]LogTemp: Warning:  DeltaTime: 0.016722, CoveredDistance: 743.392212, UpdatedDistance: 745.064392, TotalDistance: 1639.336182, CurrentPosition: X=-541.806 Y=624.740 Z=-0.500, NewPosition: X=-541.313 Y=626.041 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:788][227]LogTemp: Warning:  DeltaTime: 0.016546, CoveredDistance: 744.950317, UpdatedDistance: 746.604919, TotalDistance: 1639.336182, CurrentPosition: X=-541.313 Y=626.041 Z=-0.500, NewPosition: X=-540.818 Y=627.608 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:804][228]LogTemp: Warning:  DeltaTime: 0.016654, CoveredDistance: 746.428589, UpdatedDistance: 748.093994, TotalDistance: 1639.336182, CurrentPosition: X=-540.818 Y=627.608 Z=-0.500, NewPosition: X=-540.305 Y=629.464 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:821][229]LogTemp: Warning:  DeltaTime: 0.016733, CoveredDistance: 747.870544, UpdatedDistance: 749.543884, TotalDistance: 1639.336182, CurrentPosition: X=-540.305 Y=629.464 Z=-0.500, NewPosition: X=-539.772 Y=631.606 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:838][230]LogTemp: Warning:  DeltaTime: 0.016661, CoveredDistance: 749.325012, UpdatedDistance: 750.991089, TotalDistance: 1639.336182, CurrentPosition: X=-539.772 Y=631.606 Z=-0.500, NewPosition: X=-539.205 Y=634.089 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:854][231]LogTemp: Warning:  DeltaTime: 0.016698, CoveredDistance: 750.939087, UpdatedDistance: 752.608887, TotalDistance: 1639.336182, CurrentPosition: X=-539.205 Y=634.089 Z=-0.500, NewPosition: X=-538.923 Y=635.397 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:871][232]LogTemp: Warning:  DeltaTime: 0.016610, CoveredDistance: 751.840881, UpdatedDistance: 753.501892, TotalDistance: 1639.336182, CurrentPosition: X=-538.923 Y=635.397 Z=-0.500, NewPosition: X=-538.796 Y=635.999 Z=-0.500, bHasReachedEnd: False

--- Problem starts here ---

[2025.10.13-22.22.02:887][233]LogTemp: Warning:  DeltaTime: 0.016690, CoveredDistance: 752.284119, UpdatedDistance: 753.953186, TotalDistance: 1639.336182, CurrentPosition: X=-538.796 Y=635.999 Z=-0.500, NewPosition: X=-538.731 Y=636.309 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:904][234]LogTemp: Warning:  DeltaTime: 0.016944, CoveredDistance: 752.521484, UpdatedDistance: 754.215881, TotalDistance: 1639.336182, CurrentPosition: X=-538.731 Y=636.309 Z=-0.500, NewPosition: X=-538.693 Y=636.492 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:921][235]LogTemp: Warning:  DeltaTime: 0.016449, CoveredDistance: 752.664124, UpdatedDistance: 754.309021, TotalDistance: 1639.336182, CurrentPosition: X=-538.693 Y=636.492 Z=-0.500, NewPosition: X=-538.680 Y=636.557 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:938][236]LogTemp: Warning:  DeltaTime: 0.016565, CoveredDistance: 752.715576, UpdatedDistance: 754.372009, TotalDistance: 1639.336182, CurrentPosition: X=-538.680 Y=636.557 Z=-0.500, NewPosition: X=-538.670 Y=636.601 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:955][237]LogTemp: Warning:  DeltaTime: 0.017022, CoveredDistance: 752.750610, UpdatedDistance: 754.452759, TotalDistance: 1639.336182, CurrentPosition: X=-538.670 Y=636.601 Z=-0.500, NewPosition: X=-538.659 Y=636.658 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:971][238]LogTemp: Warning:  DeltaTime: 0.016405, CoveredDistance: 752.795837, UpdatedDistance: 754.436340, TotalDistance: 1639.336182, CurrentPosition: X=-538.659 Y=636.658 Z=-0.500, NewPosition: X=-538.661 Y=636.646 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.02:988][239]LogTemp: Warning:  DeltaTime: 0.016725, CoveredDistance: 752.786621, UpdatedDistance: 754.459106, TotalDistance: 1639.336182, CurrentPosition: X=-538.661 Y=636.646 Z=-0.500, NewPosition: X=-538.658 Y=636.662 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:004][240]LogTemp: Warning:  DeltaTime: 0.016549, CoveredDistance: 752.799438, UpdatedDistance: 754.454346, TotalDistance: 1639.336182, CurrentPosition: X=-538.658 Y=636.662 Z=-0.500, NewPosition: X=-538.658 Y=636.659 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:021][241]LogTemp: Warning:  DeltaTime: 0.016768, CoveredDistance: 752.796753, UpdatedDistance: 754.473572, TotalDistance: 1639.336182, CurrentPosition: X=-538.658 Y=636.659 Z=-0.500, NewPosition: X=-538.656 Y=636.673 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:037][242]LogTemp: Warning:  DeltaTime: 0.016674, CoveredDistance: 752.807495, UpdatedDistance: 754.474915, TotalDistance: 1639.336182, CurrentPosition: X=-538.656 Y=636.673 Z=-0.500, NewPosition: X=-538.655 Y=636.674 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:054][243]LogTemp: Warning:  DeltaTime: 0.016473, CoveredDistance: 752.808289, UpdatedDistance: 754.455566, TotalDistance: 1639.336182, CurrentPosition: X=-538.655 Y=636.674 Z=-0.500, NewPosition: X=-538.658 Y=636.660 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:071][244]LogTemp: Warning:  DeltaTime: 0.016678, CoveredDistance: 752.797424, UpdatedDistance: 754.465149, TotalDistance: 1639.336182, CurrentPosition: X=-538.658 Y=636.660 Z=-0.500, NewPosition: X=-538.657 Y=636.667 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:087][245]LogTemp: Warning:  DeltaTime: 0.016837, CoveredDistance: 752.802795, UpdatedDistance: 754.486450, TotalDistance: 1639.336182, CurrentPosition: X=-538.657 Y=636.667 Z=-0.500, NewPosition: X=-538.654 Y=636.682 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:105][246]LogTemp: Warning:  DeltaTime: 0.016876, CoveredDistance: 752.814819, UpdatedDistance: 754.502380, TotalDistance: 1639.336182, CurrentPosition: X=-538.654 Y=636.682 Z=-0.500, NewPosition: X=-538.651 Y=636.693 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:121][247]LogTemp: Warning:  DeltaTime: 0.016625, CoveredDistance: 752.823792, UpdatedDistance: 754.486328, TotalDistance: 1639.336182, CurrentPosition: X=-538.651 Y=636.693 Z=-0.500, NewPosition: X=-538.654 Y=636.682 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:138][248]LogTemp: Warning:  DeltaTime: 0.016761, CoveredDistance: 752.814697, UpdatedDistance: 754.490784, TotalDistance: 1639.336182, CurrentPosition: X=-538.654 Y=636.682 Z=-0.500, NewPosition: X=-538.653 Y=636.685 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:154][249]LogTemp: Warning:  DeltaTime: 0.016710, CoveredDistance: 752.817261, UpdatedDistance: 754.488281, TotalDistance: 1639.336182, CurrentPosition: X=-538.653 Y=636.685 Z=-0.500, NewPosition: X=-538.653 Y=636.683 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:171][250]LogTemp: Warning:  DeltaTime: 0.016375, CoveredDistance: 752.815857, UpdatedDistance: 754.453369, TotalDistance: 1639.336182, CurrentPosition: X=-538.653 Y=636.683 Z=-0.500, NewPosition: X=-538.659 Y=636.658 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:187][251]LogTemp: Warning:  DeltaTime: 0.016664, CoveredDistance: 752.796204, UpdatedDistance: 754.462646, TotalDistance: 1639.336182, CurrentPosition: X=-538.659 Y=636.658 Z=-0.500, NewPosition: X=-538.657 Y=636.665 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:204][252]LogTemp: Warning:  DeltaTime: 0.016557, CoveredDistance: 752.801392, UpdatedDistance: 754.457092, TotalDistance: 1639.336182, CurrentPosition: X=-538.657 Y=636.665 Z=-0.500, NewPosition: X=-538.658 Y=636.661 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:221][253]LogTemp: Warning:  DeltaTime: 0.016998, CoveredDistance: 752.798279, UpdatedDistance: 754.498108, TotalDistance: 1639.336182, CurrentPosition: X=-538.658 Y=636.661 Z=-0.500, NewPosition: X=-538.652 Y=636.690 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:238][254]LogTemp: Warning:  DeltaTime: 0.016746, CoveredDistance: 752.821350, UpdatedDistance: 754.495972, TotalDistance: 1639.336182, CurrentPosition: X=-538.652 Y=636.690 Z=-0.500, NewPosition: X=-538.652 Y=636.688 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:255][255]LogTemp: Warning:  DeltaTime: 0.016925, CoveredDistance: 752.820190, UpdatedDistance: 754.512634, TotalDistance: 1639.336182, CurrentPosition: X=-538.652 Y=636.688 Z=-0.500, NewPosition: X=-538.650 Y=636.700 Z=-0.500, bHasReachedEnd: False

[2025.10.13-22.22.03:270][256]LogTemp: Warning:  DeltaTime: 0.015960, CoveredDistance: 752.829590, UpdatedDistance: 754.425537, TotalDistance: 1639.336182, CurrentPosition: X=-538.650 Y=636.700 Z=-0.500, NewPosition: X=-538.663 Y=636.639 Z=-0.500, bHasReachedEnd: False

What does it say when you log all those variables at the point it stops? Is the bHasReachedEnd somehow being set true at that point?

Try using UE_LOG and logging CoveredDistance, TotalDistance, UpdatedDistance, NewPosition, and bHasReachedEnd to see what is happening.

I logged it and added it to the question and no bHasReachedEnd isn’t being set to true

What’s bothering me is why isn’t the previous frame UpdatedDistance value same as the next frame CoveredDistance ?

That could only happen if GetDistanceAlongSplineAtLocation() does not undo translate in GetLocationAtDistanceAlongSpline() right?

My guess is that GetDistanceAlongSplineAtLocation() probably isn’t quite precise enough to keep floating point values consistent. Plus this method is more likely to be able to be able to lose or gain progress if its position gets moved to another location due to external factors. Since it would simply snap the the nearest point on the spline, if the spline crossed over itself, it may choose a point with the incorrect progress.

Which might not matter to you, but even so I would probably flip this script around to work based off of distance along spline instead of actor location as an input. If you still wanted it to be able to lose or gain progress based on its position, then you can still do that. Simply have a distance threshold from your ball actor’s location to its target point along the spline, and if it exceeds that value you can have it use GetDistanceAlongSplineAtLocation() like you have.

I suspected the same, so I tried checking it like this:

In Blueprint I set the distance as 2.345


Blueprint Ue for copying

and when reverse engineering it through DistanceAlongSplineAtLocation I got the value as 2.248703
image

Which is pretty inaccurate by game dev standards and I can’t use this

However would it be possible to somehow use ElapsedTime instead of DeltaTime as an input in CalcPositionOnSpline() function and get the desired result?

I’m trying not to pass distance as an input since I have other ways of travelling instead of spline and they can be calculated via elapsed time or location and if I use distance I can’t group spline method with other methods since they would no longer have the same input