Download

Move actor from point A to point B in X secconds

Hello everyone,my name is Alex Hang, I am 17 years old and I am trying to create a FPS Game.
i use blueprints for now.
I created an actor blueprint for my characters, and at a specific time in the game I will Spawn Actor from class, and I want to move them from the point where I spawned them (or another point, let’s say point A) to a different point ( point B), but I want to give the impression that they are actually walking there, not just teleport. Using Matinee is ok for moving actors, but I want to keep spawning actors, and that doesn’t work with matinee.
I tried to use the Set Actor Location node, but it just sends the actors to that point, not moving them at that position in a specific time.
I read an older post here ( Moving actor from one point to another smoothly - UE4 AnswerHub ) saying to use a timeline, but I don’t know exactly how to setup the timeline.
Can someone please tell me a different way to do this, or explain how to use that timeline?

Seems like you need some basic pathfinding, if it’s going to be realtime in game.

I know that some actions will require an AI, but I only want to know how to move an actor from A to B in a specific time.
I will try to create all the other things after I find a way to do this

Hi Alex,

If you know the exact point (a to B), then

-Create a Timeline in your BP.
-Open the Timeline and create a Float Track (call it Alpha).
-Make it the length you need in seconds
-Right click and add a point. Make the time 0, and value 0
-Create another point and make the time [timeline length] and value 1.

-Now drag from the Update node and use the Set Actor Location node.
-Right click and type “lerp” and select the one under Vector.
-Connect the Current Actor location to Start and the goal location to the end
-Connect the Alpha Float node from the Timeline to the Alpha node in the Lerp node

Done!

Hope this helps!

Thank you very much sir, your help is very precious for me!

Glad I could help! :slight_smile:

Can you make a video of your result? I’d like to see how this works.

You can see the video result of this here:

Sorry for posting it from the phone, I don’t have access to a computer right now, but I found on my phone a recording of the game.
If you want I will come back tomorrow with a better video, made using a screen recorder

No worries thanks for posting that, it worked not half bad except for the animation speed not matching the movement. Are you doing this because you intent to have many actors moving at once? That would save on the AI computations for sure.

I tried to use AI move to, but every time I try to move the Pawn, it gives me the error “Abort”. I can see that the NavMesh is Green all over the place, but the Pawn is not moving… It fails, saying “Abort” I have no idea why. I even deleted the gun from his hand (thinking that it may block the navMesh, but apparently that’s not a solution. Of course that the AI would help me a lot, but I have no idea how to make it work, can you please help me?

Ok, I realised what I was doing wrong with the AI movement. I forgot to add a Float Pawn Movement component to the pawn, now I added it, and everything is working ok.
Thank you very much to everyone who helped me!

how do you control the speed? in case you need to change in the same map many times or have a random speed?