Character component rotation (depending on mouse position) won't replicate.
I am making a multiplayer 2D sidescroller shooter game, using the mouse to aim around. I watched the tutorial available on the UE youtube channel (here) to make the multiplayer.
The host/server can rotate his weapon towards his cursor, and this rotation is replicated to other clients without problem (clients can see where the host is pointing at)
Clients can rotate their weapon too, however the rotation is not being replicated, And I don't get why.
I get that, to make a value replicated with other players, you need to send it first to the server, who will proceed to send it to everyone (using multicast). Many forum threads are telling to do the way I did, and I understand why it should work, but it doesn't.
Here's my WeaponAim graph (I made it in the Player Controller BP) : WeaponBone is the weapon pawn, attached to the character BP's root via a child actor component. Its "Component replicates" bool is set to true.
ComputeAim is the macro that translate the mouse position into a rotation (offset Z is set to 90 so the weapon aligned in the right direction). Here's the graph in it if anyone is interested : https://i.imgur.com/oWx1xeG.jpg. CastToBP_Player simply contains "Get Controlled Pawn" to "Cast to BP_Player" nodes.
And finally here is the blueprint in action : https://i.imgur.com/vtpDWPV.gifv (sorry for the mediocre capture) (also there is a weird blur around the client weapon, i have no idea why)
Any help is welcome ! and sorry if some sentences sound weird, english is not my first language :)
asked Apr 02 '18 at 07:37 PM in Blueprint Scripting
Pass the "new rotation" reference from your macro instead of using "get world location" to pass it through. Also, make sure that your events are passing the references through (click on them to see the variables and check the box to pass through each variable).
answered Aug 21 '18 at 08:33 AM
Follow this question
Once you sign in you will be able to subscribe for any updates here