I have a custom camera setup that allows the user to rotate/orbit around a central point, and control zoom – very simple setup… After a week of research as well as lots of experimentation, I managed to get a simple LAN setup going. Host and client enter the same level, each controlling a different version of the same camera pawn. What I want is for the client pawn to mimic the host pawn’s movement and rotation 1:1. I do this for product displays where I can access UI elements and controls on my screen, and clients (as in customers) can view an identical picture minus the UI on another screen; a “beauty screen”, if you will.
From what I’ve read, I need to use a UFUNCTION to send data from server to client, this is what I have so far. I’ll just include the rotation part, for simplicity’s sake.
MyCamera.h
UFUNCTION(Reliable, Client, WithValidation)
void Client_UpdatePosition(FRotator newRot);
virtual void Client_UpdatePosition_Implementation(FRotator newRot);
virtual bool Client_UpdatePosition_Validate(FRotator newRot);
MyCamera.cpp
Void MyCamera::Tick(float DeltaTime)
{
If(Role = Role_Authority)
{
//Get Mouse Input, and turn it into positional information… This part works fine.
//Take That information, and send it to client (NewRotation)
Client_UpdatePosition(NewRotation);
}
}
bool ACamCube::Client_UpdatePosition_Validate(FRotator newRot)
{
return true;
}
void ACamCube::Client_UpdatePosition_Implementation(FRotator newRot)
{
SetActorRotation(newRot);
}
This isn’t working as expected. I’ve tried multiple variations swapping Client, Server and Roles but to no avail. Does anyone know how I can make this work?