Bone to follow pawn movement

I have a very simple skeletal mesh with just 3 bones. I would like to move those bones from my C++ code. I’ve read that some users in this forum suggest to use UPoseableMeshComponent. However, I’m not able to access it correctly in my code. I was wondering if it would be easier to simple link a pawn to each of those bones and then move the pawn using C++. Therefore, the bone will move when the pawn does so.

Does this make sense? I believe I could do the bone-pawn link using a blueprint and then move the pawn using C++.

Maybe I should follow a different approach? move the bones by using animation blueprinte whose inputs are send from the C++ code?

Any advice?

This is the approach I followed: I created a Pawn class in C++ and assign to it some movement (I’ll show some basic roation in this answer)

alt text

Then, I opened the BluePrint of that class in the editor and assigned to it a SkeletalMesh of a head. This SkeletalMesh is liked to an Animation BluePrint that I’ve also created. These are the steps I followed to link the pawn’s movement generated in the C++ code to one of the bones (the neck bone) of my skeletal mesh (the head):

  1. Keep the skeletal mesh still by ignoring the roation applied to the root component. I’ll do this in the pawn’s event graph.

    alt text

  2. In my Animation BluePrint I:

    2.1. Get the pawn’s rotation and copy it to a variable named “SkullRotation”. This is done in the Event Graph

    2.2. Apply that “Skull Rotation” to the neck bone of my skeletal mesh. This is done in the Animation Graph.

This is the final result:

Alt Text