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"

Office Holiday

Epic Games' offices will be on holiday from June 22nd to July 7th. During this period support will be limited. Our offices will reopen on Monday, July 8th. 

Trying to Replicate Character's Rotation to Other Clients

I feel this would be a common issue, but I can't seem to find anything relevant in the forums. I'm setting the rotation of my character depending on whether the mouse cursor is on the left or right of the character, so that that the character always faces the mouse (It's a side scroller type game). The method I use works flawlessly when I run it without RPC's and just on a single, local client. Problem is, once I start trying to replicate the character's rotation on another client, everything breaks and nothing happens at all. I'm using the event tick to call an RPC that replicates to the server, which then calls an RPC that replicates to everyone (multicast). I've tried putting the set rotation logic on each step of the process to no avail. I'm stuck, and I hope someone knows whats not working here. Thanks in advance.

Notes:

Everything in the image is happening inside the character blueprint.

If I take this exact same script and put it into the player controller instead of the character, them same results occur: nothing.

Setting Character Movement to replicated or not has no effect.

I set up the print strings to indicate whether or not the script was even making it to the set rotations, and it is. The print strings will correctly display either left or right depending on the mouse location, but the rotation remains unchanged.

alt text

Product Version: UE 4.21
Tags:
capture.png (294.6 kB)
more ▼

asked May 03 '19 at 02:58 AM in Blueprint Scripting

avatar image

Noodle King
10 2 1 3

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

1 answer: sort voted first

Okay I have a workaround-type solution. I found a way to set the rotation through the character movement component, which is replicated to all clients by default. I ran the script through the Player Controller, then instead of setting the actor's rotation, I set the control rotation. This sends a new rotation to the character movement component, thus replicating the rotation on all clients and the server. It's not exactly what I was looking for, but it does work. If anyone has a more specific solution id still love to hear it, but in the meantime here's my working script:

Remember to tick the "Use Controller Rotation (Pitch, Yaw, Roll)" boxes in the root component of your character!

alt text

capture.png (160.2 kB)
more ▼

answered May 03 '19 at 03:49 AM

avatar image

Noodle King
10 2 1 3

(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