Replicating Pawn Rotation

Hi there,

for my third person camera I have a custom behavior. The pawn rotates with the camera as in a shooter and the camera is allowed to rotate at any speed, but the pawn is meant to lag behind (can only rotate as fast as humanly possible).

First off I obviously disabled the option “Orient Rotation to Movement” and enabled “Use Pawn Control Rotation” in my Character blueprint. This gave me a Pawn that didn’t rotate at all, which then I proceed to do by code using my custom behavior.

what I do looks like this:

// inside my Tick function:

FRotator ControllerRot = GetControlRotation();
FRotator ActorRot = GetActorRotation();

ControllerRot.Roll = 0.0f;
ControllerRot.Pitch = 0.0f;
ControllerRot = FMath::RInterpTo(ActorRot, ControllerRot, DeltaTime, 8.0f); // temp hardcoded speed of 8
SetActorRotation(ControllerRot);

locally this works flawlessly. I rotate the camera, and my Pawn rotates slower and eventually catches up.

in Multiplayer the (listen) server player can do it and clients see it properly.
however when a client does it, neither the server nor other clients see it properly. The result is that the rotation flickers between the new rotation and the default pawn’s rotation or some other wrong value. but I thought Actor Rotation is replicated automatically?

I also tried it with Blueprints btw, and the result was the same.

Additionally I tried making a new Replicated variable that sends the Yaw of the character every Tick to all the other players, but it seems even that is getting overriden by the replicated actor rotation (so the behavior is still wrong)

any ideas?

thanks

That flickering is most likely happening because the server version is overriding the client’s version. As first approach try this. If that doesn’s work or does not apply to you, you have to make sure that the server is the one that makes the change and that it replicates that to the other clients.

thanks for the reply

you misuderstood my intentions however. CameraLag makes the camera lag behind the character, while I want the exact opposite: to have the character lagging behind the camera.

also I already had thought about being the server who overrides the value for all the others, which is why I had already tried making a new replicated variable (as stated in my first post) and even that didn’t work for me