Slowing Down Movement Speed of an Actor Along Spline - Circular Dependency

Hello,

In my project, I have actors that are able to move along a spline with movement speeds that can be adjusted by using a float curve. I would like to be able to have the actors smoothly slow down to a stop as they approach the end of the spline, however I think I am running into a circular dependency issue and it can result in taking forever to get the actor to the end of the spline.

The circular dependency comes from the fact that the movement speed depends upon where the actor is along the timeline of the spline, and the position of the actor moving along this timeline is affected by this speed.

I was wondering if anyone has ideas for a way around this problem?

Can we take a look at the code?

Hi ClockworkOcean,

Here are screenshots of the relevant blueprint scripts:

To summarize, at the top level, I have two timeline components that execute at the same time from some trigger. The EnemyPawnMover has a simple linear float curve with a slope of 1, while the EnemySpeedOverTime can have any custom curve that the designer wants.

EnemyPawnMover updates Track Alpha, which is used by FollowEnemyTrack to determine Actor Location and Rotation along the spline.

EnemySpeedOverTime updates EnemySpeedMultiplierOut, which is used by UpdateTrackDuration to adjust the Actor’s speed on the fly. The resulting speed is used to set the TrackDuration.

UpdateTimeline uses the TrackDuration to update the PlayRate of the timeline components.

The safeguard is there to prevent the Actor from getting stuck if the designer ever sets the custom float curve value to 0.

Hope it all makes sense.