Download

Set actor rotation not working properly when multicasting

Hi,

I have a set of players spawned on the server and replicated on the clients, each client controls one of the characters, so a typical multiplayer setup.
Now, when one client does a certain mouse movement, the character turns around and faces the other way. This works great on the server, but then seems to work randomly on the clients, as it only works about 50% of the time and not on a pattern that I can discern.
The actual character BP’s code is pretty simple. It always gets called when it needs to be (checked by a simple print) but the actor rotation somehow doesn’t always do its thing.

A little bump

Anyone please?
Else, is there a bugtracker I can check and/or report for this?

You want the Character of the Player moving the mouse to be turned around?

If you want to turn the Character of the Mouse moving player, then you will want to have
a “Run on Server” function and set the rotation on the client and also on the server through that
function.

Normaly, if you check “replicate movement” most of the movement will be replicated. But not custom
calculated one. So if you want that to be replicated, you will need to let the server do so.

If the bool “Replicates” and/or “Replicate Movement” are true in the defaults of your Character BP, then the
rotation change made by the server will be replicated to all other clients.
(I would like to check if setting the actor rotation manually will be replicated with “Replicates” only)

In addition: If you want to report a BUG (or if you think you maybe found a bug), feel free to visit the

AnswerHUB. You can post a question and use the section “Bug reports”.

Unreal Engine 4 AnswerHUB Link

If this doesn’t solve your problem or if you still have question, feel free to ask me.

Please make sure to explain this a bit better to me, so i can find a more exact solution for you.

This isn’t right, a multicast function is ran on each client, on their version of the character on which the function is called. For the rest I agree with eXi, if your goal is to replicate rotation I would go with what eXi proposes and set the rotation on the server with Replicate Movement enabled on the character. Rotation is then replicated automatically from server to client.

I noticed that in your screenshot, the functions aren’t actually set to multicast but execute on client? Is that the cause of your problem or did you just take a screenshot at the wrong moment?

Oh well, shame on me. I shouldn’t post at 3am :smiley: Thanks for the correction, i will edit it.

Sorry for digging up this old thread, but I’ve stumbled across the same issue and it seems to be the only thread about it: local SetActorRotation is working randomly in BP, while executing perfectly ok on the server. Did anyone find a solution to this?

Bumping the thread, as it’s still very much actual

Yep, pretty much actual.
I lost two days trying to get around this, and the answer was pretty simple. Not sure if it works for you as well, but I do hope it does.

  1. need to have this on your pawn (or the equivalent checkbox in the UE Editor)
  1. no need for custom RPC, multicasting and such. The Controller is the key piece here:

I was extremely shocked when this worked, after trying to reinvent the wheel myself. Apparently, all I needed was to take a more thorough look at the Controller headers