There are some thing wrong with GetBaseAimRotation

FRotator LastBodyRot;
FRotator LastControlRot;
FRotator BodyRot = OwnerCharacter->GetActorRotation();
FRotator ControlRot = OwnerCharacter->GetBaseAimRotation();
LookRotOffset = UKismetMathLibrary::NormalizedDeltaRotator(ControlRot, BodyRot);
	if (LastBodyRot != BodyRot || LastControlRot != ControlRot)
	{
		UE_LOG(LogTemp, Log, TEXT("BodyRot: %s"), *BodyRot.ToString());
		UE_LOG(LogTemp, Log, TEXT("ControlRot: %s"), *ControlRot.ToString());
		UE_LOG(LogTemp, Log, TEXT("LookRotOffset: %s"), *LookRotOffset.ToString());

		float YawDifference = FMath::FindDeltaAngleDegrees(BodyRot.Yaw, ControlRot.Yaw);
		UE_LOG(LogTemp, Log, TEXT("Yaw Difference: %.2f"), YawDifference);

		LastBodyRot = BodyRot;
		LastControlRot = ControlRot;
	}

Sometimes BodyRot.Yaw and ControlRot.Yaw will suddenly become the same, but this only occurs when using multiple clients. The situation is quite perplexing, how to modify the code to solve this issue?

Hey @wycsusushui how are you?

It seems as you have a replication issue here.

Are you having this issue with local players, with remote players, or both of them?

In the meantime, you can try by checking the network authority to get the most accurate rotation source for each client type using something like this:

FRotator BodyRot = OwnerCharacter->GetActorRotation();
FRotator ControlRot;

// Handle differently based on authority
if (OwnerCharacter->HasAuthority())
{
    // On server, use the replicated control rotation
    ControlRot = OwnerCharacter->GetBaseAimRotation();
}
else
{
    // On client, prefer local player controller if available
    if (APlayerController* PC = Cast<APlayerController>(OwnerCharacter->GetController()))
    {
        ControlRot = PC->GetControlRotation();
    }
    else
    {
        ControlRot = OwnerCharacter->GetBaseAimRotation();
    }
}

I’ll be waiting for your answer!