I’m trying to move player on navmesh (like in top down example) in project that is primarily first person (with WSAD movement). I added a function to my player controller
void AMyPlayerController::MovePlayerOnNavmesh(FVector DestLocation) {
APawn* const Pawn = GetPawn();
if (Pawn)
{
UNavigationSystem* const NavSys = GetWorld()->GetNavigationSystem();
float const Distance = FVector::Dist(DestLocation, Pawn->GetActorLocation());
if (NavSys)
{
NavSys->SimpleMoveToLocation(this, DestLocation);
}
}
}
but it’s not working. Is there something I’m missing?