Announcement

Collapse
No announcement yet.

Character component rotation (dependending on mouse position) don't replicate.

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Character component rotation (dependending on mouse position) don't replicate.

    Hello everyone, I am making a multiplayer 2.5D 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 plane). 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


    #2
    Alright so when I check "Reliable" on the multicast event, the client's pawn get depossessed right after connecting. After some research about this issue, I saw that one should not put a multicast event in a Player Controller BP, and instead replace it with a On Owning Client event. So consider my WeaponAim graph above unchanged except for the multicast event, which is now a RELIABLE On Owning Client event.
    Also i forgot to write it, but the WeaponAim event is called each time the mouse moves (Input Axis event).

    Comment

    Working...
    X