How to make Timeline finish

What am I trying to achieve?

Currently trying to get my Flying AI to go to various Waypoints in the sky.

How am I making them move?

I have a timeline calling the SetActorLocation which is Lerping between the Start and End vectors[1]. I then have a float track to update the Lerp as the Time/Length progresses[2].

The issue I am having

The AI moves to the Waypoint before the Timeline finishes, this is shown through the Print Text function I have. The AI reaches the Waypoint but sits for seconds sometimes minutes (depending on the Length set) before it triggers the FInished event.

Questions

  1. I feel like I am not understanding how the Length works and thus confusing when it should actually be finished, if so an explanation would be much appreciated.
  2. Is their a better way to do this or is the Timeline not firing the event properly?

Please let me know if you need anymore information.

1 Like

It sounds like you just want to use the “MoveTo” functionality. If you’re doing stuff like patrolling then you probably want to use a Behavior Tree. Inside there is a node called “Move To” as well. Search YouTube for “Patrol AI”. Try following one or two tutorials. The project(s) you create from them may not be usable in your main project but they will give you some exercise with the AI features. If you use them to their fullest then you won’t be wasting time/energy/CPU/etc to reinvent something they already do for you.

As far as your timeline issue, that’s pretty darn weird. If you feel you must do it this way then I can try to look into it further, but it doesn’t matter what your track is doing in the timeline. It’s the length of the timeline that determines when Finished gets triggered. It looks like you have it set to 5s, so I find your issue very strange.

One possible reason the timeline isn’t finishing is that the Play pin is getting executed while the timeline is playing and somehow that is messing up the logic. You could try putting a “Do Once” node in front of it, then when the timeline is finished, in addition to your functionality, execute the “Reset” pin so it will pass execution through the next time. If you have more than one thing to do on Finish then either make sure the Reset is done as the last step or use a Sequence node to trigger Reset and then do your other stuff. Not sure that’s the issue but it might be, and hopefully it’s moot because you’re going to use a behavior tree.

That is actually the issue, funny how I figured that out for the B pin but not for the A pin.

Thanks for the quick replies I have also looked into the “Move To Location” option, it turns out it was hidden because of context sensitivity. I used that function instead of the Lerp and Timeline and it works.Thanks for simplifying everything for me and I will for sure checkout some videos.

The only issue/question is that I need to know when it finishes so I tried using “Move to Location or Actor”, the same destination vector does not work for this function and I have no idea why.

Do you have any insight into this issue? why the same vector would work on one function but not the other? If this should be in a different thread I’ll mark this one as resolved an open a new one.

It is actually because you have the Get Actor Location plugged directly into the A pin of the lerp. You need to set the actor location as a variable right before the timeline node and then plug that variable into the A pin.

However, like Jin_VE said, it is probably better to use the AI Move To. It can give you smoother motion if you set it up correctly.

I’m not sure I agree. SetActorLocation is being called and GetActorLocaiton is being used. That should make using a variable extraneous.

But actually, I think you’re on to something because for the Lerp to work, you need to use the starting location, not the current one. The timeline goes from 0->1 so it should be driving the value between start position and end position – not current position and end position. Using a current value is for the “Interp To” functions.

It’s might be because you need a NavMesh. There are resources explaining that too. Just do a search. If you have any questions, let us know. You can probably click the down-arrow in the “Move to Location or Actor” node (if needed) and turn off “Use Pathfinding”. But any good AI needs to be able to find paths through the world so I recommend looking into how to set up a NavMesh.

Oh right. Flying. I forgot…

Pathing in 3D is a bit complicated. I think there’s a plugin you can buy that does it. Do you need pathing or is just moving from A to B all you need?

What is it about “Move to Location or Actor” that you require? Why isn’t the other one sufficient?

Did you try turning off continuous goal tracking? That may require an actor for it to use for location updates.

Here is an image to better illustrate[1]

Since it is for Flying AI I think NavMesh is out of the question unless implementing your own from what I have researched. I have also fooled around with the different pins to mirror the Move to Location one but it still fails :frowning:

I gave it a vector with no Z and it works… so my assumption is that “Move To Location or Actor” can’t be used for Vector3D but only 2D but “Move To Location” can use Vector3D?

This just doesn’t seem right… I have also changed the Movement Mode to “Flying”

Forgot to mention that “Move To Location or Actor” works if using a Target Point as actor and get rid of the Vector3D destination, which seems like a bug.

Just need a simple Point A to B by giving a vector3D, no pathing is necessary so going the Plugin is not really needed, The reason why that function is desired is because it already lets you know when it has reached its destination.