Efficient Path to Travel the object through point with Timeline in Unreal Engine

I’m currently working on a project in Unreal Engine 5.2 where I need to dynamically adjust timeline durations in Blueprint based on varying distances between path points to ensure smooth and efficient movement. Specifically, I’m looking for guidance on calculating and setting movement speed based on these distances.

I have path points stored in an array of vectors, and I’ve noticed that my current implementation results in the same travel time between points, regardless of whether they are very close or far apart. How can I effectively adjust movement speed to optimize travel from the starting point to the last point in my path array?

When I pull the item, i have got the path of the points as seen in the red dot.

Before you run the timeline between each pair of dots, you can just scale the play rate with the formula

image

DefaultDistance is the distance you are happy with the timeline taking the amount of time it currently does. ThisDistance is the per dot gap.

So if the gap between a pair of dots is twice as far, it will run at half the speed.

1 Like

I did try to setup my blueprint like this, but happen very weird. What didn’t work on my bp?

Can you try ‘play from start’?

you could try using MoveComponentTo instead of timelines

Same nothing changes.

how does MoveComponentTo works with the points of array, i need to follow the object through the paths i specified in array,

when it completes you get the next point in the array and then repeat until the array is empty

i am a very beginner to this, any blueprint example would help me to understand.

also the move component to accepts the component, but i need to move the Actor.

you cant use a ForLoop on an Latent task like in you second post.

Basic flow

  1. Call MoveTo Event
  2. Check Is MoveArray empty if so complete
  3. else begin movement using timelines or moveTo etc
  4. movement completes, remove MoveArray element 0.
  5. call MoveTo Event

It’s exactly the same code you had in the first place, except you change the TL speed before each iteration…

1 Like

this is a answer. thank you this helped me.

1 Like