AttachToComponent doesn't respect RelativeTransform rule

Hi!
I’m trying to attach a component to another in C++. It successfully attaches but the Position doesn’t change when I set : FAttachmentTransformRules::KeepRelativeTransform in the AttachToComponent function.
For example, if my object is in (0, 0, 0) world position, the object I attach it to is at (10, 0, 10), the object position after attachment will me (-10, 0, -10) (as its world position will not have changed)

/* the BeginPlay of PlayerPawn the element I want to attach to the GameBox */
void APlayerPawn::BeginPlay()
{
	Super::BeginPlay();
        // I put the world transform to (0, 0, 0) just to show that the relative transform doesn't work
	RootComponent->SetWorldTransform(FTransform());

	auto World = GetWorld();
	for (TActorIterator<AGameBox> It(World); It; ++It)
		It->AttachComponent(RootComponent);
}


/* declaration of AttachComponent in GameBox.h */
void AttachComponent(USceneComponent* c,
				      const FAttachmentTransformRules& AttachRules = FAttachmentTransformRules::KeepRelativeTransform);

/* Defininition of AttachComponent in Gamebox.cpp (Plane is the RootComponent of GameBox */
void AGameBox::AttachComponent(USceneComponent* component,
                               const FAttachmentTransformRules& attach_rules)
{
    component->AttachToComponent(Plane, attach_rules);
}

I have tried not using the default argument for AttachComponent but it doesn’t change anything.
The code is available here:
(it’s very simple so should be easy to understand)

But that’s what KeepRelativeTransform does, the world position of the attached object stays the same afterwards.

What exactly are you trying to achieve?

Isn’t it what KeepWorldTransform does?
Whether I put KeepWorld or KeepRelative it doesn’t change anything.

Yeah so KeepRelativePosition should be it but it’s not. Tbh I just tried to switch to all different Transform in the function call and it doesn’t do anything so I’m starting to think that I might be doing something wrong in the code…

I want to have my Pawn position in the world to become the pawn position relative to the GameBox. So if the Pawn was in (0,0,0) and the GameBox is at (10, 10, 10) The Pawn should be at (10, 10, 10) when attach (and so (0,0,0) relatively to GameBox))

https://www.reddit.com/r/unrealengine/comments/5l89oc/question_when_using_attachtocomponent_what_do_the/

Isn’t that SnapToTarget?

I’ve got the same bug (4.25).

Hey I’m looking at my code again (things work smoothly now) and I still use
USceneComponent::AttachToComponent(…)
Aka this : AttachToComponent

Do you have any more details on your issue?