How to sync AnimInstance with c++ code?

Briefly, I have the following problem: my c++ code generates an event that attach my actor to a vehicle. The animation should change accordingly, nevertheless, they have a different root, therefore for 1 - 2 frames I see the Actor with the wrong animation attached to the vehicle assuming a wrong position.

My question is: How can I force the AnimInstance to change state in the AnimGraph? What are the possible solutions to my problem?

Hmm… it would be better to show the code, a snapshot of the AnimBP, possibly a video. Are you not trying to just play an AnimMontage out of your event? What does ‘they have a different root’ mean? Who is ‘they’? If you are not using Montages and you just rely on AnimInstances that different states play, then your event just changes a bool (or condition) that forces a state change in your AnimBP - as you well know. So maybe it’s a matter of fixing the animation perhaps? But as I say above, some more clarifications are necessary here to help you more.

Thanks for your reply. It seems I have the same issue as reported here Get updated bone locations after calling UpdateAnimation? - Character & Animation - Unreal Engine Forums
What solved my issue was performing the following calls

SkMesh->GetAnimInstance()->UpdateAnimation(0.f, false);
SkMesh->RefreshBoneTransforms();
SkMesh->AttachToActor(GetOwner(),
                           FAttachmentTransformRules::SnapToTargetNotIncludingScale,
                           SocketName);