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
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 :
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 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”.