Change speed of spline movement

I have a mesh set up to move along a spline; when the spline is short the mesh travels at a reasonable speed but as soon as I make the spline longer, it moves at a crazy speed. How do I set a constant slow speed?

Here is the blueprint setup

Thanks for the response! Could you possibly set up an example as I’m not entirely sure how to set it up properly?

This worked, thank you so much

Your problem is you are animating over a fixed length of time (your timeline) across the entire spline length. So it travels further each update because it has to make the distance over the same amount of time. What you have is a fixed duration with a varying length.

What you want is a fixed speed with a varying length. Instead of saying “No matter the length, go the entire distance in x time” you want to “Move x amount down the length each tick.”

So make a variable called “speed” and another called “currentDistanceDownSpline”.

Use either tick or a timer to add currentDistanceDownSpline to speed/deltaTime (deltaTime is a blueprint node or dragged out of Tick) and set your actor’s position to that new distance down the spline.

I don’t have access right now but i can describe it.

Create some variables like:

Speed:float = 1 (this is distance per second)
CurrentDistance:float = 0 (we use this to track our current distance easier)

On tick you need to set currentDistance to currentDistance + speed/DeltaTime (deltaTime is what you get from tick or you can use the built in stand alone node called something like WorldDeltaSeconds)

Next set the actors location to GetLocationAtDistanceAlongSpline and for the distance pass in your currentDistance variable.

This way we increment the distance each tick by a constant Speed and find that distance down the spline to set our position to.