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. 

[BUG] Character Rotation Replication Issue

I am seeing a bug when the rotation of a character is replicated, specifically it's the roll that is causing problems.

The rotation works fine on the server or autonomous clients, but on simulated clients the rotation seems to be offset.

I've taken a look at the ReplicatedMovement being received on the client, and the location/correction is correct.

It appears that only the character visual is incorrect, the actual capsule appears to be in the right position/rotation. My suspicion is that this is caused by the mesh component (which is a child of the capsule) not rotating correctly on the client (Like the samples, my mesh location and rotation has been tweaked to make it line up with the capsule). Could this be on the rendering side of things?

I've also confirmed that this still occurs with 4.2.

This is easy to achieve with the Third Person Code Template:

 // Hook to input key
 void AThirdCharacter::RotateProblemStart()
 {
     ServerDoRotate(); // Tell the server to rotate
     SetActorRotation(FRotator(0, 0, 90)); // Do it locally on the controlling client
 }
 
 // Client -> Server RPC
 void AThirdCharacter::ServerDoRotate_Implementation()
 {
     SetActorRotation(FRotator(0, 0, 90)); // Rotate on server, this will replicate to remote clients
 }

Server/Controller: alt text

Client: alt text

Collision: alt text

Product Version: Not Selected
Tags:
server.jpg (285.3 kB)
client.jpg (13.4 kB)
more ▼

asked May 23 '14 at 12:22 AM in Bug Reports

avatar image

Joeh
118 4 7 18

avatar image Didek May 26 '14 at 10:29 PM

I'm having the same problem. I'm curious if this is a known engine bug and what I can do to fix it? I'd rather not have to debug way down into the engine to try to find the cause of this issue. Maybe there is some sort of work around to this problem?

avatar image Joeh May 27 '14 at 09:52 PM

No one has any suggestions to help? This is blocking implementation of a major feature in our game. Looks like Didek is also effected.

avatar image Ben Halliday STAFF May 27 '14 at 10:31 PM

Hey Joeh,

I am looking into this issue for you, and will update you as soon as I can. Thanks for your patience so far!

Ben Halliday

avatar image Joeh May 27 '14 at 10:56 PM

Thanks Ben!

avatar image Joeh May 29 '14 at 06:41 PM

Don't suppose you have had any luck with this?

avatar image Joeh Jun 10 '14 at 01:40 PM

I can confirm this is still a problem with the released version of 4.2. Ben, have you made any progress reproducing this?

avatar image Ben Halliday STAFF Jun 10 '14 at 03:38 PM

Hey Joeh,

Sorry for the delay in response. I've checked in with the developers on this issue and can confirm that they are looking into it. I hope to hear something soon, and will let you know as soon as I do. Thanks again for your patience!

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

3 answers: sort voted first

Hi,

I suspect that the assumptions about a vertically oriented capsule in the mesh offset code is messing with the mesh translation. It appears that the capsule itself is oriented correctly (based on the "show collision" result you posted, though it would be nice to confirm that with a shot on both sides).

Try overriding UCharacterMovementComponent::SmoothClientPosition and SmoothCorrection to do nothing in your own component and see if that makes a difference. That is only run on the client and is the only thing I can think of that is messing with the offset on the client and not the server.

more ▼

answered Jun 10 '14 at 05:33 PM

avatar image

zeroexception STAFF
1k 18 16 39

avatar image Joeh Jun 10 '14 at 06:01 PM

It looks like those smoothing methods are indeed the culprit. I'm not sure if this is a candidate for being resolved on the engine side, or if it makes most sense for us to override them and have different behavior for our custom movement mode.

What are your thoughts?

avatar image zeroexception STAFF Jun 10 '14 at 06:21 PM

Glad you were able to work around it!

I think this is an issue with the engine code only because we assume a vertical capsule orientation. Down the road we were looking at possibly removing this assumption and adding support for arbitrary Up vectors, at which point we'll have to fix this.

There is one line of code in SmoothClientPosition() that zeros the MeshTranslationOffset.Z if walking, I wonder if just removing that line in your own version would fix the issue. If so I would recommend only doing that when walking and the orientation is vertical. Character itself also does some things explicitly with Z in the crouch methods, which might be an issue later.

avatar image Joeh Jun 10 '14 at 06:51 PM

I don't think it can be the zeroing Z, because IsMovingOnGround requires you to be in the Walking movement mode. Nothing else in either of those methods jumps out at me as being a problem.

I'll dig into a little more and see if I can find the exact culprit.

avatar image Ryan Darcey Jun 02 '17 at 06:45 PM

Just hitting this myself. Wondering if you found a solution? :D

avatar image zeroexception STAFF Jun 15 '17 at 03:26 PM

See rcdarcey's comment below, hopefully that is helpful.

avatar image Ryan Darcey Jun 15 '17 at 03:34 PM

yahp...answered my own question here ;)

avatar image zeroexception STAFF Jun 15 '17 at 03:38 PM

Lol sorry. I was confused by why the thread was split. Glad it's working!

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

A "Server" function executes only on the server. It is not replicated serve -> other clients.

You have two options:

  • Create a UFUNCTION(NetMulticast) void BroadcastNewRotation(FRotator NewRot). BroadcastNewRotation_Implementation will do the rotation. Call BroadcastNewRotation() from your ServerDoRotate() (NetMulticast functions can only be called by the server). Note that NetMulticast functions also run on the server itself, as well as all clients.

  • Create a FRotator MyRot that is RepNotify: UPROPERTY(ReplicatedUsing=OnRep_MyRot), add MyRot to the GetLifetimeReplicatedProps() function, and create a OnRep_MyRot function that modifies the rotation. See ShooterGame for examples -- plenty of them there, for example, the variable BurstCounter in AShooterWeapon.

more ▼

answered May 23 '14 at 12:46 AM

avatar image

Ixiguis
1.2k 57 61 253

avatar image Joeh May 23 '14 at 12:51 AM

Hi,

Sorry, but that isn't correct. Location and Rotation for characters is replicated, you can clearly see that's the case as the rotation has taken effect on the client.

You can take a look at ACharacter::PostNetReceiveLocation, that is running correctly on my client and has the correct Location/Rotation.

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

I found a very simple solution for this! At least for characters in MOVE_Flying mode. Not sure it'll work for MOVE_Walking, but worth a try.

Anyway, it seems like all I needed to do was set bUseControllerRotationRoll to true on the pawn and...BOOM. No more server network smoothing fighting roll rotation :D

more ▼

answered Jun 15 '17 at 12:01 AM

avatar image

Ryan Darcey
836 47 42 69

(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