Hi all,
I have found the code in the UpdateControlRotation() function:
FVector TheCenter = GetFocalPoint(); //Retrieve the final position that controller should be looking at.
if (!TheCenter.IsZero() && GetPawn()){
FVector Direction = TheCenter - GetPawn()->GetActorLocation();
FRotator TheNewRotation = Direction.Rotation();
TheNewRotation.Yaw = FRotator::ClampAxis(TheNewRotation.Yaw);
SetControlRotation(TheNewRotation);
APawn* const P = GetPawn();
if (P &&bUpdatePawn){
P->FaceRotation(TheNewRotation, DeltaTime);
}
}
How to use it to make an AI bot face my player? How to use GetFocalPoint()?