Make player character lock on and move toward target

Oh I get it :smiley:

Yeah, you would have to check if the stick value is left or right. If it is right (Input>0) then move towards the target.

You can get the direction vector by subtstracting both locations (like I posted in the first answer)

FVector DeltaLocation = Target->GetActorLocation() - this->GetActorLocation();

So now when the stick input is to the right side, just move your player in this direction. You would need to specify a speed variable or something and then move your player along this Direction ever frame. Code could look like this:

FVector DeltaLocation= Target->GetActorLocation() - this->GetActorLocation();
FVector DesiredNewLocation = this->GetActorLocation() + DeltaLocation;

FVector NewFrameLocation = FMath::VInterpTo(this->GetActorLocation(), DesiredNewLocation, DeltaTime, InterpSpeed);

this->SetWorldLocation(NewFrameLocation );

Call this every frame and your player should move forward. InterpSpeed is a variable that you have to set.

FMath::VInterpTo() smoothly interpolates between the current location and the given desired location.

EDIT: I just typed this up, there might be typos in the code, let me know if it works.