In your character blueprint properties, make sure “Use Controller Rotation Pitch” is enabled, then it should replicate just like the yaw.
EDIT:
Actually that would make the whole character rotate (which I’m assuming is not what you want :p) so here is a way you can replicate the camera rotation.
(Also you should disable “Use Controller Rotation Pitch”.)
Hey, thank you so much for the quick reply! It works flawlessly :o !
But I’m really confused now. I watched the whole “blueprint networking” series by Epic, but it looks like I still don’t understand how the “switch has authority” is supposed to work.
I thought it stops the execution of the blueprint if the owner is “remote” (in this case - not the server). Why does the client get to the “Multicast Replicate Rot” event, even though he’s not the authority? Could you please explain that to me?
EDIT: For example, this part of my blueprint doesn’t work as intended (only the server can execute, what’s after the event):
I noticed that the Event doesn’t have “Execute on all” written in it’s description and I don’t know how to enable that. Any suggestions?
Simply put: Authority does not (always) equal server it’s a common beginner mistake to think Authority/Remote as Server/Client but there is a reason we use the term Authority instead of Server
In this case, the client has network authority over the pawn it controls.
(I’m probably not the best guy to explain this stuff :p)
That’s interesting. What you said has been said in the video as well, but it sadly wasn’t explained further. I’m really thankful for your help, but I’d like to ask you for one last piece of advice. How would you handle the issue I stated in my post above? Until now I was using a “workaround”. I experimented for some time and a configuration like this worked for the most part:
This way both the server and the client and the server see the shot being fired. I used this “config” (two custom events - one set to “multicast” and one “run on server”) a few times, but I have a feeling this is not the right way to do it… So if you have some tipps, that’d be great
I made a tutorial series on fps multiplayer shooter and there I addressed this pitch replication problem i this episode, here is the link to the video.
If your entire character will be pitching and not just parts of it like say your arms or just your head, then yes. It will need to be on tick or a timer that loops pretty quickly to get a smooth replicated rotation.
I can post an example for you when I get back to my machine a little later. There is a great short little video on YouTube that called How To Replicate Pitch in under a minute I believe it works great if you want to try and find it in the meantime.
You need to set your Pitch variable inside of your character blueprint to replicate. You might also need to set the pitch variable inside of the animation blueprint to replicate.
I replicated both for the time being, and it works ok
I also do the math on the client side before doing the RPC call. Also, the RPC call takes my character class which for now is just ThirdPersonCharacter, and the Pitch float variable.
I then set the ThirdPersonCharacter’s pitch value again on the server side.
Have you set pitch in animBP cast Directly from CharBP? Also (can be overlooked) is CharBP replicate flag ticked?
Mine works with this type of setup but the response is terrible (laggy/jittery)
You can create a function inside your character blueprint called “ControlRotation” and it should set a replicated rotator variable and should look something like this:
It is important to set the replicated condition to skip owner or you’ll have actors rotating that aren’t supposed to.
You will need to get this variable inside your animation blueprint to set your pitch variable so that everyone can see you rotating. Also noting that here I also have the pitch variable to skip owner and is also replicated. You can carry out your logic anyway you see fit here, but its important to make a few checks to make sure the player is valid otherwise you’ll get a very long list of errors if they are not valid. This is especially true if your character is dead. It will throw them up the whole time your character is destroyed and is waiting for a respawn and becomes valid again.
Lastly, call this “ControlRotation” function on event tick in your character blueprint and make sure you have a check in place there so if your character is not possessed so it won’t throw errors there as well. Like a branch that is checking something like “IsDead?”
Since you are presumably doing this over network, you can play with the network update frequency in your character bp to get the most ideal/optimized rotation look in terms of network bandwidth usage, but it looks kind of choppy when its turned down below 60 your character may be jumping around as well if its too low. Running it on a timer, seems moot to me since it will look like terrible on anything less than your typical framerate anyway. The computational expenditure of running this function on tick might knock out a negligible amount of fps, but its a trade off I’ve accepted. I’ve tried it both ways.
I’ve seen some multiplayer games not replicate pitch at all. I’m sure this can save a bit of bandwidth and also framerate if there is just waaay to much going on in the game…