How do I replicate pitch input (no blendspace)?

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.

ReplicateRotationExample3

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.

ReplicateRotationExample

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…

1 Like