How to assign different speeds at different points along a spline

I am trying to create a fish movement system in unreal using a spline. The fish should swim along the spline, jump out of the water, slow down near the highest point of the jump, accelerate as it falls, and then return to its normal swimming speed. I currently use Distance Along Spline, Spline Speed, and Delta Seconds to move the fish. My main question is how I can assign different movement speeds to different sections or points along the spline, so that the speed changes according to the fish’s position rather than according to a fixed Timeline.

A clean way is to drive speed from a Float Curve keyed by normalized spline position instead of a Timeline. Create a Curve Float asset (or a Runtime Float Curve variable on the actor) where X = 0..1 (Distance / Spline Length) and Y = speed multiplier, e.g. 1.0 while swimming, ramp down near the jump apex, then up again during the fall. Each Tick: Alpha = Distance / Get Spline Length, Speed = BaseSpeed * Get Float Value(Curve, Alpha), Distance += Speed * DeltaSeconds, then Get Location/Rotation at Distance Along Spline (World). If you prefer to tie it to specific spline points, use Get Distance Along Spline at Spline Point for the jump start/apex/end points and lerp between per-section speeds with Map Range Clamped (or FInterp To for smoothing). For a physically plausible jump you can also compute speed from height: Speed = sqrt(Base^2 - 2*g*(Z - WaterZ)), clamped to a minimum so it never stalls at the apex.

You can use GetInputKeyValuesAtDistanceAlongSpline to find out which spline segment your fishy is on. It returns a float like 1.5 if it’s halfway between point indices 1 and 2. Truncate that, then use find on a map variable which uses float for a value, and integer as a key. Would look something like this in a bp:

I just stuck logic in conscript so I could see the speed var change as I tweaked the slider on the distance var in editor window. Instead of just using a simple float as value for map, you could make a struct holding other member vars in it (like maybe a bWantsToJump bool or whatever you could use for other logic). Biggest downside of doing it like this is you would have to add new keys to map every time you add a spline point. Could partially automate that in conscript by checking if length of map < number of points and adding to map on true.