How? 2 moving Objects with different paths hitting same location at the same time (lerp?)


the setup:

  • Object A is traveling to stationary Location A
    Time to reach the location is dynamic / Closing distance is known

  • Object B is traveling from another point to Location A
    Path length is dynamic / Path is set before start and known

  • Both Objects only move forward

my issue is the following:

I want Object B to hit the location at the same time Object A does. My guess is to use a lerp from the distance of Obj A and Loc A and set the traveling pace of Object B that way; but I can’t find a proper solution.

thanks in advance for any suggestions



For 2 objects, like this:

But if the path length is changing you can’t make them arrive at the same time.

Also, you don’t specify what sort of path you’re talking about, because this will move them in a straight line. If you don’t want that, then you need to use spline, probably.

both are travelling on splines. Obj A on a straight one and Obj B on a random one. That part is already solved.
Looking at your solution I’ll try to change the timeline output into being the distance of Object A t Location A which goes from N to zero.

ps: the path of both is set before. They just don’t have to same distance to Location A
And the distance itself can change anytime the script is run.

added a screenshot of how Object B is being moved when using time as its driving force.
what I am trying to achieve is that the distance value which is going from “N to zero” of Obj A - Loc A is used as the driving force.

Hi ClockworkOcean,
thanks for your quick reply.
Obj A is a Pawn controlled by speed, thus Timeline is out again. Sorry for not being very clear from the start, didnt know where to begin explaining.

obj a is controlled by a dynamic speed variable!

Ok, then move A with a timeline, and use tick and an interp to position B at the same proportion of distance along it’s spline. Incidentally, you might as well just use GetTransformationAtDistanceAlongSpline.

So A just uses a timeline like this, B is on tick. Each tick it reads the alpha from A’s timeline and move to the corresponding postion on it’s spline.

Ok, but you can still see how far along the spline it is right?

Calculate that as a % and use tick to move B to the same % along it’s spline.

correct. going to implement it right away.
will make a new post with the solution if someone else is having the same issue

thanks for taking your time!

thank you very much! don’t know why I didn’t think of % by myself.
I just got it running and couldn’t find any issues so far.

to anyone reading this:
I just divide my ticked Object A Location with static Location A and feed that to the multiplier on the screenshot above. the value for the variable goes from zero to 1.