I found a solution that works exactly what I want! Now, even if I attach the character to the train, there is no problem with movement.
Just override the “void UpdateBasedMovement(float DeltaSecons)” function of the custom CharacterMovement component in C++. This function applies the velocity from the Actor the Character is standing upon to himself. If the character is attached to this actor he gets twice the velocity of the moving Actor.
source : https://answers.unrealengine.com/questions/141747/view.html
void UMyCharacterMovementComponent::UpdateBasedMovement(float DeltaSeconds) {
if (CharacterOwner->GetRootComponent() == nullptr || CharacterOwner->GetRootComponent()->GetAttachParent() == nullptr)
{
Super::UpdateBasedMovement(DeltaSeconds);
}
else
{
return;
}
}