Hi all, I added some custom feature on my first person character to make the camera rotation separate from controller rotation, which is to say, the direction I’m looking at is not necessarily align with the direction my body is facing.
I created a variable “LookRotation” and achieved my goal. However when I tried an online mode, only the controller rotation but not the aim offset was replicated to the clients.
I’m not acquainted with those replication things and all the work I did was that to add below codes into my character class.
MyCharacter.h:
UPROPERTY(Replicated)
FRotator LookRotation;
MyCharacter.cpp:
void AMyCharacter::GetLifetimeReplicatedProps( TArray< FLifetimeProperty > & OutLifetimeProps ) const
{
Super::GetLifetimeReplicatedProps( OutLifetimeProps );
DOREPLIFETIME(AMyCharacter, LookRotation);
}
It didn’t work when a client see the server / other clients and the LookRotation always stayed at 0.
Thanks a lot in advance if anyone can help me out.