Is there any easy way to have actors turn toward a pawn with c++ at the time of spawning?

Hi.
I’m trying to build a basic plane dogfight game in c++. Its a 3D game.
I’m trying the whole vector math thing using GetWorld()->GetFirstPlayerController()->GetPawn()->GetActorLocation(); and then this->GetActorLocation to try and calculate the angle between the Player Controlled Pawn and the Enemy planes so that I can rotate the Enemy Planes toward the Player Pawn at spawning. But I have failed.

Does anyone know of any decent tutorials on the subject?

Also if my Player Controlled Pawn is facing directly east at spawning - do I really want to be calculating angles between locations of the Player Pawn and the Enemy planes? Or is it the forward vectors that i’m after?

Thanks.

How are you spawning your enemies?

UWorld::SpawnActor() takes a transform or a rotation and location if you are using that.

Continuing on Balgy’s suggestion, you can find the rotation needed with UKismetMathLibrary::FindLookAtRotation and set the rotation of your enemies to that when spawned with UWorld::SpawnActor.