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"

Why is yaw rotation the only rotation replicating to remote pawns?

I have a round world so I updated the character movement component to allow for walking around on such. The characters feet always point towards the center of the world. To allow for this every tick if the character is moving I adjust their control rotation. This worked well in single player, but now that I'm setting this up for multiplayer I have to do this on the server. Upon doing so the server characters are all reporting the correct rotation. The clients only report their owned pawn rotation correctly (the pawn they are controlling), the remote pawns do not inherit the correct rotation from the server. Why is this?

Product Version: UE 4.13
Tags:
more ▼

asked Nov 24 '16 at 01:33 AM in C++ Programming

avatar image

Thumper
961 139 149 387

avatar image Thumper Nov 29 '16 at 07:53 PM

I'm not making any progress on this. I call a server function to adjust the rotation and I can see on the server the rotations are correct. But only the yaw is correct on the clients. Somewhere there is something prohibiting the Roll and Pitch from replicating.

avatar image Thumper Nov 29 '16 at 11:55 PM

If I manually set the rotation on the remote pawns (perhaps this is what I'm supposed to do?) Then the rotation is fine, except that it twitches as if it's being told to have the bad rotation, but the proper rotation that I'm manually setting is fixing it. This confuses me because if I'm supposed to set the rotation on the remote pawns after the server has updated the movement then I would expect the rotation was not touched by the server. So I believe that the server is actually updating the rotation, but it is only updating the yaw rotation, but still setting the rotation with inaccurate Roll and Pitch values that are not being replicated to the client.

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

1 answer: sort voted first

Hi, I also struggled with this some time but have found the solution by checking the ShooterGame example. There is a function called GetBaseAimRotation() for Characters, never saw that one before. The ShooterGame example takes this value and transforms it into local rotation this way:

Header file:

     /** get aim offsets */
     UFUNCTION(BlueprintCallable, Category = "Game|Weapon")
     FRotator GetAimOffsets() const;

CCP:

 FRotator AShooterCharacter::GetAimOffsets() const
 {
     const FVector AimDirWS = GetBaseAimRotation().Vector();
     const FVector AimDirLS = ActorToWorld().InverseTransformVectorNoScale(AimDirWS);
     const FRotator AimRotLS = AimDirLS.Rotation();
 
     return AimRotLS;
 }

You can also access this function in Blueprints since it's marked as BlueprintCallable and use the return value to animate your Aim animations.

Greetings!

more ▼

answered Jan 23 '17 at 07:42 PM

avatar image

Xetatronics
6 1 5

avatar image Elou44 Apr 23 '17 at 10:19 PM

Thank you very much sir, it worked perfectly for me! I should be looking more often at the sample projects ;)

avatar image YourBabaYaga Jun 25 '17 at 08:32 PM

OMG . . i was also struggling with this problem for a day . . Thank you so much Xetatronics thnku . . :)

(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