In unreal right now they only replicate pitch for client in Pawn, and you can only get that through C++ only. They replicate by taking value from Controller rotation from server, because only server and owner client have controller, which indicate where you look.
So here you need to get controller rotation, then get pitch and yaw from there and save to some replicate value for client to see.
I have saved pitch and yaw in a variable like you said.
But how I can now use this Variables in AnimBP?
I have tried to send a InterfaceMessage with Pitch and Yaw. (didn’t work)
And I Have tried to make this Variable public, but I dont know which Target I have to set.
This works in C++ without doing any extra replication. I only have the C++ code but I’m pretty sure everything is exposed in blueprint. This is used in the Shootergame C++ example for the first person aim offsets to replicate. Control rotation does not replicate but view direction is available for a pawn so you work backwards.
@dancode@spacebares I understand this solution will work for replicating the pitch. Will this work in a third person game for replicating the yaw if your character class has bUseControllerRotationYaw set to false?
I have a third person perspective game, with bUseControllerRotationYaw set to false, and I need to replicate the controller aim yaw value so that way it can rotate the head left and right, but have been unable to find a way without adding my own custom yaw replication code.
Does someone know of a solution for this? Should the above code work for this?
Hello,
I just ran into this issue, and using the information dancode provided solved it (in Blueprint).
So I can confirm the controller pitch and yaw are indeed both replicated and available via Get Base Aim Rotation.
I am lazy and so using a control rig for the look-at behaviour, which is easiest implemented with a target point, so my fixed (network friendly) version of setting this target point now looks like this:
and works well. Looking at it again, probably the select is unnecessary and you could just use Get Base Aim Rotation always.
If you explicitly need yaw (from actor forward) to feed into a Aim Offset, you will need to do the transform dancode provided on it.
Edit: My bad. Yaw was not coming through, I was seeing things. This post was very insightful, and with modifications got my project fixed up properly (nutshell version: what we want is replicated to the server, but no further, so you unavoidably need to get your hands dirty here).