Actor move to the character's position

Hi,

how can I make a Actor move to the character’s position and stop, even if Character has already left his position. The Actor should only move in the X direction.

example:

Thank you in advance for your support!

Only moving on X plane, like a side-scroller or Mortal Kombat?

The basic way would be using a MoveTo node, which requires it has an AI Controller (probably does) and there be a NavMesh bounds. If actor is the target I believe it will move to where the actor is even if they move.

If the target actor is in a straight line from it, along X, it will only move in a straight line to it. Beyond that, it depends what you’re trying to do.

But I was assuming the actor is a pawn. A basic actor, maybe a MoveComponentTo node on the root component.

Or you could try an Finterp to, updating actor’s X location.

that’s what I mean:

The problem, the actor stops as soon as the character leaves his position. The actor should continue to move to the character’s original position, even if the character is no longer there

I should have asked what is it. A projectile? An arrow? Another character? What I would do depends on what it is.

Actor is an enemy, he should only move in zigzag, i.e. move X and Y direction

Is he doing zig zag dash attacks? Not walking in a zig zag.

move in Zigzag, but first I want the actor to move to the character’s position even if the character leaves its current position

Why using a linetrace? You can just get player location (get player pawn > get location) and store it as a variable , then use that variable (break it and only use the X axis) to ‘set actor location’, don’t use ‘add local offset’ (‘add local offset’ every tick adds 100 units every tick, it moves the actor in that direction continuously). Use a Timeline to animate the current location to the new location with a nice ease-in-out curve. And why is it all placed on the Event tick? Make custom events and only activate them when necessary (Since you don’t want to store the current player position every frame and it’s a waste of resources).

Can you show me in blueprint exactly what you mean by that. The actor should not move until the line trace hits the character

That wasn’t very clear to me. In that case you could use the linetrace to detect the player. Once it detects the player it activates a custom event. That event should just fire once to determine the player location and then activates the animation to move to that location via timeline. (Vinterp could also be an option, but it requires event tick). I don’t really like the fact that the enemy is constantly firing a linetrace though. Maybe there is an other way to use a large collision box attached to the enemy, when an overlap is detected it fires the same event but it’s hard for me to grasp your idea of how everything should interact together in your game.

P.S.
I could make some BP screenshots at home but I’m at the office right now, you have to wait a bit, hopefully someone else is able to help you. Maybe I can find some time for you this evening.

I’m looking forward to it.

Can anybody help me!

Help!

do you mean galaga style movement? the actor should move to the position where your character was / is but only in x axis ?

1 Like

Yes

ok,
takes an hours or so, my kids going to bed now, then i start typing :smiley:

see you later :vulcan_salute:

1 Like

Thanks!