I have the following bit of code in my class extending AAIController:
UE_LOG(LogTemp, Warning, TEXT("MOVING TOWARDS CHARACTER %s AT POSITION %s"), *TargetedCharacter->GetName(), *TargetedCharacter->GetActorLocation().ToString());
MoveToLocation(TargetedCharacter->GetActorLocation());
The log successfully prints out
LogTemp:Warning: MOVING TOWARDS CHARACTER Ash_C_0 AT POSITION X=-954.872 Y=134.872 Z=190.150
LogTemp:Warning: MOVING TOWARDS CHARACTER Ash_C_0 AT POSITION X=-852.143 Y=32.144 Z=190.150
LogTemp:Warning: MOVING TOWARDS CHARACTER Ash_C_0 AT POSITION X=-745.443 Y=-74.557 Z=190.150
But my character does not move.
So I tried to run MoveToLocation from BeginPlay, and there is still no movement.
However, if I run seemingly the exact same bit of code from Blueprints with a Blueprint extending AI Controller, like so:
It seems very much like calling these functions from C++ is broken.
If there’s a way to fix this so that I could avoid Blueprints that would be wonderful!
If not, is there another workaround?
Update: I can also see here that when I use the C++ call, the status for the character is set to moving and there is a goal with a path and a path end.
Ok, from the docs AAIController::MoveToLocation | Unreal Engine Documentation Can you overload the MoveToLocation, upto a point where you can give it a bUsePathfinding value? seems like that is enabled in blueprint, so i think thats the reason
I know I can be late to the party but encountered exactly the same thing. Problem of course was in my code where I was not calling Super::BeginPlay() in my AIController BeginPlay override. I hope it helps somebody.
Man, you saved my life. I was looking for a solution about ai character not chasing my character and it was due Super::BeginPlay() was missing on my AI COntroller. Thank you a lot!