Unintended Spline Acceleration

Hey there y’all, so I’ve got a pretty straightforward circular spline attached to my pawn subclass with code that should make it loop at a set rate, but when I play in the editor, the pawn accelerates to ludicrous speeds. Any ideas as to why?

(SplineSpeed is set to 0.001f in the header and never changed)

// move our gunship along the currently set spline

if (SplineComponent->GetSplineLength() != 0.0f) {

SplinePos += SplineSpeed;

if (SplinePos >= 1.0f) {

SplinePos = 0.0f;


// location

VisualMesh->SetRelativeLocation(SplineComponent->GetLocationAtDistanceAlongSpline(SplineComponent->GetSplineLength() * SplinePos, ESplineCoordinateSpace::World));

// rotation

VisualMesh->SetWorldRotation(SplineComponent->GetRotationAtDistanceAlongSpline(SplineComponent->GetSplineLength() * SplinePos, ESplineCoordinateSpace::World));


Don’t need the SplineComponent->GetSplineLength() * in there, don’t know why I had it there to begin with!

Also, don’t know why I assumed it worked on a lerp-style input system requiring values between 0 and 1, SplinePos just needs to be bound by the value of GetSplineLength, and therefor the speed can be way higher! Also also, I had the component attached to my mesh originally, which is really unnecessary and possibly added to the issues that led to the strange acceleration.