How can I disable the blueprint from overriding my bone transform?

I am trying to animate the eyes to track the camera.

In my custom UAnimInstance in the NativeUpdateAnimation function I execute the following to see if I can transform a bone:

USkeletalMeshComponent* skeletalMeshComponent = GetOwningComponent();
int32 boneIndexRight = skeletalMeshComponent->GetBoneIndex(FName("??????_R_bones_27"));
skeletalMeshComponent->LocalAtoms[boneIndexRight].AddToTranslation(FVector(0.0f, 1.0f, 0.0f));

When I run the game, I can see the eyes move and then snap back into the original position.
I’m guessing that something in the blueprint is overriding the transform as the blueprint animation is ran after.

I’ve tried setting the bone in the skeletal mesh to Skeleton rather than Animation however the issue still occurs.
I’ve also tried disconnecting the State Machine from the Final Animation Pose, however the issue still occurs.

How can I disable the blueprint from overriding my bone transform (if that is the case)?
I would like a fully C++ solution so that any instances of my custom UAnimInstance will have the functionality built in.


There is UPoseableMeshComponent class that allows you to move all bones manually, or you can try other solutions from this question.