x

Search in
Sort by:

Question Status:

Search help

  • Simple searches use one or more words. Separate the words with spaces (cat dog) to search cat,dog or both. Separate the words with plus signs (cat +dog) to search for items that may contain cat but must contain dog.
  • You can further refine your search on the search results page, where you can search by keywords, author, topic. These can be combined with each other. Examples
    • cat dog --matches anything with cat,dog or both
    • cat +dog --searches for cat +dog where dog is a mandatory term
    • cat -dog -- searches for cat excluding any result containing dog
    • [cats] —will restrict your search to results with topic named "cats"
    • [cats] [dogs] —will restrict your search to results with both topics, "cats", and "dogs"

Character component rotation (depending on mouse position) won't replicate.

Hello everyone,

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) : alt text 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 :)

Product Version: UE 4.19
Tags:
more ▼

asked Apr 02 '18 at 07:37 PM in Blueprint Scripting

avatar image

Kadronk
1

(comments are locked)
10|2000 characters needed characters left
Viewable by all users

1 answer: sort voted first

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).

more ▼

answered Aug 21 '18 at 08:33 AM

avatar image

Debaucher
67 1 6 8

(comments are locked)
10|2000 characters needed characters left
Viewable by all users
Your answer
toggle preview:

Up to 5 attachments (including images) can be used with a maximum of 5.2 MB each and 5.2 MB total.

Follow this question

Once you sign in you will be able to subscribe for any updates here

Answers to this question