Trying to Replicate Character's Rotation to Other Clients
I feel this would be a common issue, but I can't seem to find anything relevant in the forums. I'm setting the rotation of my character depending on whether the mouse cursor is on the left or right of the character, so that that the character always faces the mouse (It's a side scroller type game). The method I use works flawlessly when I run it without RPC's and just on a single, local client. Problem is, once I start trying to replicate the character's rotation on another client, everything breaks and nothing happens at all. I'm using the event tick to call an RPC that replicates to the server, which then calls an RPC that replicates to everyone (multicast). I've tried putting the set rotation logic on each step of the process to no avail. I'm stuck, and I hope someone knows whats not working here. Thanks in advance.
Everything in the image is happening inside the character blueprint.
If I take this exact same script and put it into the player controller instead of the character, them same results occur: nothing.
Setting Character Movement to replicated or not has no effect.
I set up the print strings to indicate whether or not the script was even making it to the set rotations, and it is. The print strings will correctly display either left or right depending on the mouse location, but the rotation remains unchanged.
Okay I have a workaround-type solution. I found a way to set the rotation through the character movement component, which is replicated to all clients by default. I ran the script through the Player Controller, then instead of setting the actor's rotation, I set the control rotation. This sends a new rotation to the character movement component, thus replicating the rotation on all clients and the server. It's not exactly what I was looking for, but it does work. If anyone has a more specific solution id still love to hear it, but in the meantime here's my working script:
Remember to tick the "Use Controller Rotation (Pitch, Yaw, Roll)" boxes in the root component of your character!
Follow this question
Once you sign in you will be able to subscribe for any updates here