Set Actor Rotation soemtimes doesn't work in multiplayer - easy steps to reproduce

  1. Start 3rd person character BP project in 4.22.3
  2. In ThirdPersonCharacter bp, add a Set Actor Rotation on left click, set it to the controller’s rotation: https://i.imgur.com/tNUo6Nq.png
  3. Play. You will see the character rotates in the direction the camera is facing on left click. Works great.
  4. Tick “Run Dedicated Server”
  5. Play. You will see that many times the character will not rotate on left click.

I understand this scenario is not properly replicated and no other player will see the character rotating which is fine. But why is this rotation sometimes not working?

  • The return value from Set Actor Rotation is always true, even when it doesn’t work.
  • If I print out the rotation before Set Actor Rotation and after the Set Actor Rotation … it’s hard to explain this. So the after ALWAYS shows the rotation it should have changed to. The before ONLY shows this rotation if you see that the actor has rotated. So as an example…

(Controller rotated to yaw 110)

  1. Click 1 (didn’t work). Before: 0,0,0. After: 0,110,0. Character hasn’t rotated.
  2. Click 2 (didn’t work). Before: 0,0,0. After: 0,110,0. Character hasn’t rotated.
  3. Click 3 (worked). Before: 0,0,0. After: 0,110,0. Character rotated.
    (Controller rotated to yaw 200)
  4. Click 4 (didn’t work). Before: 0,110,0. After: 0,200,0. Character hasn’t rotated.

So… always after the Set Actor Rotation, “Get Actor Rotation” will return the correct rotation even though the character has not rotated visually. I did a weird test: https://i.imgur.com/PLeUYrZ.png . After the “Set Actor Rotation”, the first “Get Actor Rotation” shows where it should have rotated to. Then, after that .1 second delay, it starts printing the old rotation.

So somewhere in that .1 seconds, the character’s rotation is being (sometimes) undone.

Edit: I did another test, rotating a simple static mesh actor instead of the character and this worked every time. So there must be something about the character that’s causing this sporadic behavior. Continuing to test.

Edit2: Instead of using Set Actor Rotation on self, I specified the mesh on the character. Doing this seemed to work every time… but I’m not sure it’s what I really want to be doing. I tried specifying the capsule component specifically and got the same inconsistent results as before with both Set World Rotation and Add World Rotation.

Edit3: Ah-HA! If I disable the movement component, the rotation works perfectly (using Set Actor Rotation). So there’s something in the movement component that’s preventing this from working right. It seems like disabling the movement component temporarily is a bad way to go about fixing this so I’m looking for other solutions. Maybe I can perform the rotation using the movement component instead.

2 Likes

Did you figure this out? I’m seeing the same issue.

Sorry for necroing this old thread, but has anyone found a solution for this? I’m using unreal 5.6 and I’m facing a very similar issue with a listen server and a simulated client.

Server correction is why.

CMC has built in client-side prediction and server correction.

Actually after a lot of debugging, I found that my issue was not related to SetActorRotation itself, but with a race condition caused by network latency (I’m using unreal network tools to simulate average network conditions). Basically there were two competing things trying to set the actor rotation.

But thanks for the response!

With CMC you’re working with either Pawn Rotation or Controller Rotation. Both report rotation changes to CMC for client-side prediction, if you use the correct functions.

If you’re not using the proper functions/approach you will get conflicting arguments for rotation. CMC’s will override on the server-side and force a client correction.

That’s all I’m saying.


in PIE Advanced settings set the servers fps to 30Hz. If you don’t it’ll try an tick at the same freq as clients. You’ll get nasty network issues as a result.

Also BaseGame.ini ClientSendMoveDeltaTime defines the client → server movement update send freq. default is 16.6667ms

1 Like