Replicating Actor Rotation
I'm trying to replicate my actor rotation to all other clients which are connected in a multiplayer game. So far I've already achieved the implementation of a boolean called bIsAiming, following this awesome tutorial: https://wiki.unrealengine.com/Survival_Sample_Game:_Section_5#Making_the_player_sprint.
However I tried to get the replication of the rotation working in the same manner but keep stumbling across the problem that the rotation is only set on the calling client + the server. This means the server fails to tell all other clients to update the rotation of said actor accordingly. I'm a bit puzzled at the moment. I already tried to replicate an FRotator and SetActorRotation in the EveryTick method but this wasn't successful either.
Here is my code example, perhaps someone can point me in the right direction :-)
the setRotation method is called here in the .cpp
Thanks in advance!
P.S: Is it possible that the characterMovementComponent already handels the replication of the bIsCrouched and if a character is in the air? I didn't need to implement methods for jumping and crouching as they were perfectly working in a multiplayer setup.
This should get you started. I typed this all off of the top of my head so it's likely a made a mistake somewhere. Let me know if you have any more problems/questions.
bonus points: non-owner instances of the game could interpolate to smooth out the animation (note that RInterpTo is not frame-rate independent. you would want to use a fixed time-step function plus interpolation or extrapolation to get perfect frame-rate independence, but this example should be good enough to get you started)
Okay I got it working and Cancel was absolutely right (marking your answer as the solution now).
There is just one slight adjustment which has to be made in order for it to work properly:
Do not call OnRep_OwnerRotation() or SetActorLocation before this if statement. Otherwise it will f*** everything up :D
Thank you very much canel!
answered Aug 23 '15 at 01:43 PM
Follow this question
Once you sign in you will be able to subscribe for any updates here