Download

Questions about bone transforms

Hello!

I want to apologize right now if any of this has been asked before (I looked but didn’t find it on the forums).

I’m planning to create a “replay system” plugin. My team decided we needed it for a project we began in UDK, but we never got beyond the research phase of developing it. We did find that others had implemented their own versions of the feature though so it is a proven concept.

Our strategy atm is just to monitor and serialize the transforms of every “qualifying” object in the level. This would be a non-blueprint solution.

My problem is that I can’t find in the documentation how to access the transforms of of a bone. Honestly, I’m not too clear on how to traverse an actor’s bone hierarchy at all.

I’ve been looking through the animation docs (https://docs.unrealengine.com/latest/INT/API/Runtime/Engine/Animation/index.html). USkeleton, FBoneNode and FBoneTransform seem like the things to focus on but I could use some help in getting to them.

So, concretely I’ll ask: If I have a boned actor with a simple skeletal hierarchy, how could I in C++ log( print to screen, write to a file, etc ) the position and rotation of their right forearm every frame? The actor is running and shooting and reloading their gun, basic fps stuff, and I want to get the transform of their right forearm bone at every frame.

Thanks for reading.:smiley:

The easiest way is to use GetSocketLocation(RightForearmBoneName), as all bones on a USkinnedMeshComponent double as sockets.

If you want to enumerate over all bones, check out BoneTree in the USkeleton asset. The final transforms from evaluating the animation go into SpaceBases on the anim component, but the ordering there isn’t necessarily the same as the skeleton (it’s only got the bones needed for the active skeletal mesh reference mesh (SkeletalMesh->RefSkeleton)).

Cheers,
Michael Noland