Local client actor rotation and replication issues

So I’m toying with a third person hack and slash prototype currently and I’m using the third person template as a base.
I’ve started to add network replication and things are mostly going OK, all movement replicates, attacks replicate, health replicates, etc.
However, I’m looking to tweak the existing TP controls slightly so that when a character attacks they snap their actor rotation to that of their controller, making it so that a player will always attack in the direction their camera is facing.

I’m having a nightmare trying to get rotation replicating properly, I’ve been looking through old posts and various Google search results and have managed to get most of the way there. The rotation of a character replicates perfectly on the servers client (as expected) and the rotation of each connected player is also replicated to the server and all other connected clients properly.

This is where things get weird. The only situation where the actor rotation isn’t set reliably is on the local client. It will snap to the correct rotation about 80% of the time but then out of nowhere will just stop setting the actor rotation no matter how much the attack button is spammed it just will not move. If the cmaera is then moved again slightly it will start setting rotation correctly until it then (seemingly randomly) stops again.
I am using the attached blueprint for setting rotation and replicating it to other clients.

It looks as if there is some sort of race condition on the client somewhere that is stopping the set rotation from being run locally. The controls being used are just the standard TP template controls.

Any advice would be greatly appreciated, thanks in advance

I have the exact same issue within the exact same circumstances. Hope we’ll manage to find a solution quickly.

Here are some of the leads I’m going to follow :

  • Multicast the rotation update
  • Find out if we messed up some of the Rotation / Movement Replication presets
  • Cast on Client the rotation update
  • Update locally on event tick the rotation update through replicated rotation variable
  • Find out if we are locally overriding the rotation
  • Find out if there’s simply a bug in the Set Rotation Replication behaviour
  • Update the rotation locally
  • Toy around with the Character Movement Component properties “IgnoreBaseRotation” / “UseControllerDesiredRotation” / “OrientRotationToMovement”

I’ll let you know how it goes

I managed to get it work with a very ugly method.

Here are the blueprints :

http://hpics.li/33e8a2f

When I right-click I launch “Server Update Rotation”. This function is shown here :

http://hpics.li/83f3f3f

Server Update Rotation is cast on server and also calls “Client_UpdateRotation” which is a “Cast On Client” event which also sets up the new rotation :

http://hpics.li/f308db0

Finally, after I called “Server Update Rotation” on the first blueprint, I also locally update the rotation.

So I update the client rotation three times in a row : on server, then on client, then locally.

I’m having trouble understanding exactly what you’re trying to do…

When you right click, you want your player to snap to the rotation you clicked?

And this wasn’t happening on all clients, but now you’ve fixed it?

Is that right?

When I right click, I want the Player’s Avatar (the Character) to instantly rotate to look at my cursor’s position.

I had and finally still have the same problem than the thread creator.

Approximately 3 or 4 out of 10 times, my Rotation is not updated on the LOCAL client (the client I’m currently playing on). The rotation is updated on the Server and on the Client 2 but not on Client 1 (if I’m playing on Client 1).

If you have any lead I’d be gladly listening.

I have another idea concerning our problem : mybe our animation blueprint is somehow locally overriding the rotation ?

I never thought of looking at the anim blueprint. I’ll give that a try…

I managed to find a solution.

I cant provide a screenshot right now but I can drop it anyway.

Your rotation event triggers => send the rotation you want to a Server Event.

The Server Event sets the rotation of your Character (using “Set Actor Rotation”). Then stores the given rotation in a replicated Variable (lets say “MyRotation”).

Then on an event tick I’m casting on the client (Remote Authority) Set Rotation to “My Rotation”.

This worked great for me, tyvm!

your welcome ue4bro !

Here are the screenshots for my setup: