Hi. I’m finding it hard to find C++ tutes for using AIController.Anyway…
Using Unreal 4.20.
I have a Enemy class derived from Pawn. Then BP_Enemy is a blueprint of Enemy.
I’ve set up a EnemyAIController class that extends AIController.
In BP_Enemy I have set AutoPossess AI to Place in World or Spawned. AIController Class is set to EnemyAIController.
In EnemyAIController::Tick I get the location of the Player with
FVector actorLocation = GetWorld()->GetFirstPlayerController()->GetPawn()->GetActorLocation(); and that works.
But calling this->MoveToLocation(actorLocation); from the EnemyAIController Tick method does nothing.
The enemies spawn on the screen but they don’t move.
In the Enemy class that is the base for BP_Enemy I don’t have a movement component set up. But wasn’t sure if that’s necessary.
I also wasn’t sure if the appropriate thing to do was to get a reference to the AIController from within Enemy and then call MoveToLocation from there.
Could do with some advice pls.
Thanks.