Description

An attached actor's relative location isn't correct on the client when the actor has its position changed to that of the parent actor before attaching with the "Keep World" location rule. On the client, the attached actor will have an offset from the parent equal to its offset from the origin. It looks like the relative location isn't replicated from the server in this case, since to the server, it looks like it hasn't changed from (0,0,0). On the client, this means that when the attachment is updated, its location relative to the world becomes its location relative to its new parent.
If the root component isn't replicated, AActor::OnRep_AttachmentReplication seems to handle updating the actor to the correct relative location. If the actors being attached are at different locations, the server will replicate down the correct relative location, so the client will have the attached actor at the correct location. If the "Snap To Target" rule is used, the client will have the actor in the same position as on the server.

Steps to Reproduce

Spawn a replicated actor (actor A) with a replicated root component at the same position as another replicated actor (B), and then attach A to B using the "Keep World" location rule.
Expected: Both the server and the client will show actors A and B at the same position.
Actual: The server will have actors A and B in the same position. The client will have actor A in a different position to where it is on the server, as A will be offset from actor B by an amount equal to actor B's offset from the origin.

Have Comments or More Details?

There's no existing public thread on this issue, so head over to Questions & Answers just mention UE-136337 in the post.

0
Login to Vote

Fixed
ComponentUE - Networking
Target Fix5.1
Fix Commit20287109
Main Commit20287109
CreatedNov 30, 2021
ResolvedMay 19, 2022
UpdatedMay 28, 2022