How do I attach a projectile to another actor

I am attempting to create a ‘sticky’ projectile that when it collides with a Pawn, will stick to that pawn in the same location where it initially collided. This behavior is working to some extent, but the behavior I’m seeing is very odd. It seems like the Pawn the projectile attaches to is pushed around by the projectile after the attachment. That isn’t the behavior I want, but I’m unclear as to how to achieve that behavior currently. Here is the relevant code which is called when colliding with a Pawn:

AUTProj_Grenade::OnStick ()
{
    ProjectileMovement->Deactivate();

    EAttachLocation::Type AttachLocationType = EAttachLocation::SnapToTarget;
    AttachRootComponentToActor(HitActor, NAME_None, AttachLocationType);
}

I am not quite sure what needs to be done here to prevent my projectile from interfering with the Pawn movement while successfully attaching it to the Pawn.

You need to make the target and the projectile ignore each other during collision detection, something like

RootComponent->MoveIgnoreActors.Add(HitActor);
HitActor->GetRootComponent()->MoveIgnoreActors.Add(this);

Hey, thanks for getting back to me on this. That was the correct solution although the syntax was a little off. For reference for those who might be curious what the exact solution was I am posting my code below.

void AUTProj_Grenade::OnStick_Implementation(AActor*
HitActor, const FVector& HitLocation) 
{
HitActor->GetRootPrimitiveComponent()->MoveIgnoreActors.Add(this);
GetRootPrimitiveComponent()->MoveIgnoreActors.Add(HitActor);
EAttachLocation::Type AttachLocationType = EAttachLocation::SnapToTarget;
AttachRootComponentToActor(HitActor, NAME_None, AttachLocationType);
}

I am also trying to “toss a ball and when it hits a pawn, it sticks to them”. Think more like throwing a ball at a pawn and them “catching it” by sticking to them. How did you get yours working?