Attached Actor Location not initialized in replication?

I have an issue where I am currently spawning the player, and the player then spawns himself a weapon with SpawnActor (server side via RPC). The weapon actor is spawned server side, and and attached to the socket. However, when the weapon is replicated, it seems the weapon has a random (uninitialized?) relative location and rotation, which does not exist on the server (The locations are all correct there). I can fix this by setting them to 0 on BeginPlay for clients, which gets rid of the bum value.

From everything I have read, and examples I have seen, it appears I have my replication set up properly. But it seems that the weapon actor, when replicated and spawned on the clients, is getting some random relative location and rotation (confirmed in debugger).

The question:

  • Am I doing something odd or incorrectly for the replication here?
  • Why is the RootComponent->Relative* values, when ROLE_SimulatedProxy, wrong values and not matching the server?

Spawned with:

void AArenaCharacter::BeginPlay() {

    if (HasAuthority()) {
        ActiveWeapon = GetWorld()->SpawnActor<AArenaWeapon>(StartingWeapon);

attached with:

void AArenaWeapon::BeginPlay()
    SetActorRelativeLocation(FVector(0.f, 0.f, 0.f)); <--- WHY IS THIS NEEDED?
    SetActorRelativeRotation(FRotator(0.f, 0.f, 0.f));<--- WHY IS THIS NEEDED?

UFUNCTION(Server, Reliable, WithValidation)
void ServerEquip(AArenaCharacter *WeaponOwner);

void AArenaWeapon::ServerEquip_Implementation(AArenaCharacter *WeaponOwner) {
    WeaponMesh->AttachToComponent(WeaponOwner->GetMesh(), FAttachmentTransformRules::KeepRelativeTransform, TEXT("hand_rSocket"));

ArenaWeapon Constructor:

AArenaWeapon::AArenaWeapon(const FObjectInitializer& ObjectInitializer)

	PrimaryActorTick.bCanEverTick = true;
	WeaponMesh = ObjectInitializer.CreateDefaultSubobject < USkeletalMeshComponent >(this, TEXT("WeaponMesh"));
    bReplicates = true;
	RootComponent = WeaponMesh;


Thanks for the inside! We had a similar issue when spawning a weapon in a client-server scenario. Would be interested to learn why we need to reset relative rotation/location after spawning.

I have the same problem. I need to manually assign a value of 0 for rotation and location for a mesh component before replication start. If I skip this step, my playercharacter is not placed correctly and behave very badly… I did not have this problem before 4.15