theres a perfect example of that in the Shootergame:
void AShooterAIController::UpdateControlRotation(float DeltaTime, bool bUpdatePawn)
{
// Look toward focus
FVector FocalPoint = GetFocalPoint();
if( !FocalPoint.IsZero() && GetPawn())
{
FVector Direction = FocalPoint - GetPawn()->GetActorLocation();
FRotator NewControlRotation = Direction.Rotation();
NewControlRotation.Yaw = FRotator::ClampAxis(NewControlRotation.Yaw);
SetControlRotation(NewControlRotation);
APawn* const P = GetPawn();
if (P && bUpdatePawn)
{
P->FaceRotation(NewControlRotation, DeltaTime);
}
}
}