Attached is a composite of values from the server when I control the character on the server, and values from the client when I control the character from the client. In this setup I’m replicating two properties both of which are FRotators.
// Current Facing of the pawn
UPROPERTY(Replicated)
FRotator pawnFacing;
// Current Facing of the pawn
UPROPERTY(Replicated)
FRotator pawnCR;
//.cpp
void AKoreChar::GetLifetimeReplicatedProps(TArray< FLifetimeProperty > & OutLifetimeProps) const
{
Super::GetLifetimeReplicatedProps(OutLifetimeProps);
//Gravity Scale, Adjustments in In-Game Editor
DOREPLIFETIME_CONDITION(AKoreChar, pawnFacing, COND_OwnerOnly);
DOREPLIFETIME_CONDITION(AKoreChar, pawnCR, COND_OwnerOnly);
}
I update the rotations on the server with this RPC (which is a server RPC)
void AKoreChar::SERVER_ChangeFacing_Implementation(FVector inVec)
{
Capsule->SetRelativeRotation(FRotationMatrix::MakeFromZX(Capsule->GetComponentLocation(), inVec).ToQuat());
Controller->SetControlRotation(Capsule->GetComponentRotation());
pawnCR = Controller->GetControlRotation();
pawnFacing = Capsule->RelativeRotation;
}
When the client gets those values they are not the same. The rotations go past 180 (On the server they stay between -180 and 180). So when I use those values it causes my character to flip. Why is the replicated rotation different on the client than on the server?