Accessing 3rd Person Character Location BP In C++

Hey,

I just joined a development team and alot of there stuff is in blueprints since they did not have a programmer. I am building a character AI in C++. I am trying to get the location of the player in the game For example.

AAvatar *avatar = Cast(
UGameplayStatics::GetPlayerPawn(GetWorld(), 0) );
if( !avatar ) return;

FVector toPlayer = avatar->GetActorLocation() - GetActorLocation();

Only thing is I cant point to anything because there is no C++ Player class(Avatar). They made it in a blueprint.

If you just want to access the location then you can cast it to Actor or Pawn and get their location like this.

Actor* Avatar = Cast<AActor>(UGameplayStatics::GetPlayerPawn(GetWorld(), 0));
if (Avatar)
{
    const FVector ToPlayer = Avatar->GetActorLocation() - GetActorLocation();
}

Thanks! Much Apprecaited