Try UNavigationSystem::SimpleMoveToLocation
Example as follows:
FVector targetLocation = Nexus->GetActorLocation();
UNavigationSystem::SimpleMoveToLocation(Controller, targetLocation);
This works for me in my project, as I have dozens of pawns move around the map.
Syntopia
(Syntopia)
2
I forgot to call Super::BeginPlay(), after that everything worked.
Syntopia
(Syntopia)
3
Hello,
I need to move the bot to the some place.
I create a controller from AAIController, in its BeginPlay I write, move to the main character:
ATPSCharacter* player = (ATPSCharacter*)UGameplayStatics::GetPlayerCharacter(GetWorld(), 0);
FVector vec = player->GetActorLocation();
//MoveToActor(player);
MoveToLocation(vec);
I create in editor BP from Pawn/Character and assign the new Ai controller.
I launch, the bot doesn’t move, what could be the problem?
If I do the same thing with BP, everything works, NavMesh on the map.
all code
.cpp
.h