How to get a specific bone in C++ to manipulate it later?

Hi all, I have a big problem with getting a specific bone to rotate it. There is GetSocketByName() and why not GetBoneByName()? My code:

  USkeletalMeshSocket const* MHSpine3Const = MH->GetMesh()->GetSocketByName("spine_03"); USkeletalMeshSocket const* EnemySpine3Const = Enemy1->GetMesh()->GetSocketByName("GunSocket");      if(MHSpine3Const && EnemySpine3Const){          USkeletalMeshSocket* MHSpine3 = const_cast<USkeletalMeshSocket*>(MHSpine3Const);          USkeletalMeshSocket* EnemySpine3 = const_cast<USkeletalMeshSocket*>(EnemySpine3Const);          if (MHSpine3 && EnemySpine3) {              FVector MHSLoc = MHSpine3->GetSocketLocation(MH->GetMesh());              FVector Enemy1SLoc = EnemySpine3->GetSocketLocation(Enemy1->GetMesh());              FVector Forward = (MHSLoc - Enemy1SLoc); FRotator PlayerRot = FRotationMatrix::MakeFromX(Forward).Rotator();

  And then I would use  
 EnemySpine3->RelativeRotation = PlayerRot; 

But I cannot get the bone using the code:

 USkeletalMeshSocket const* EnemySpine3Const = MH->GetMesh()->GetSocketByName("spine_03"); 

How to rotate a given bone in code? Because I want to make an AI bot to aim at a given point of my player character in C++.

You can’t get bones like that because skeletal mesh animations are threaded. You’ll have to find the skeletal mesh’s proxy before you get access to any bone data.

Thank you for your answer. So how to make an AI bot to aim at my character player? How to rotate an AI bot to face my character player? Of course, in C++, not in blueprints.

Learn how to use Animation Blueprints and Anim Nodes.
Epic has a bunch of youTube videos and Twitch streams on their YouTube channel.

So an Anim Blueprint is the only way to achieve that. Is that common in other Third Person Shooter projects?

PoseableMeshComponent.And then you can manipulate the bone using this function:
PoseableComponent->SetBoneRotationByName(BoneName, Rotation, EBoneSpaces::ComponentSpace);

Can it be used for a typical AI bot?

Google “UE4 aim offset tutorial”. It’s extremely common

Thank you. Is it enough for making an AI bot to aim at my character. Just aim offset. The problem is that I made a few aim offset animations in Blender and it doesn’t work as it should.

By the way, guys, maybe you know how to make strafe animations in Blender.