What math to calculate an even play rate for movement along a spline regardless of length?

I’ve set up a simple actor BP with a spline and a skeletal mesh that moves along said spline. I’ve also set the play rate of my timeline (which is 1 second long) to be 1/DurationInSeconds meaning whatever number I type for DurationInSeconds is how long it will take to play the timeline. It’s all working perfectly.

My question is; what would the math be to determine the duration to use regardless of the length of the spline so that the mesh looks like it’s always moving at a consistent speed? The mesh that I’m moving along the spline is a flying drone, and I want it to look like it has a specific top speed so to speak. Rather than just eyeballing it, I figured there’s probably an equation involving the length of the spline and my desired movement speed that I can use to calculate it precisely. I just suck at math so I have no idea what that would be :stuck_out_tongue:

Duration in Seconds = Spline Length / Desired Velocity

1 Like

OMG is it really that simple? LOL. I was asking my buddy who’s good at math and describing the problem to him (he doesn’t know game design) and at the end of it I said Spline Length divided by Speed = duration of timeline (I know this isn’t the equation, but I need that).
So apparently I instinctively knew the answer? ha ha

Thanks!

1 Like