How to get a bone location for the first frame of an AnimMontage?

I know this is an old thread, but I found myself wanting to do this recently, and I didn’t have a Skeletal mesh to grab it from.

I made a BP library Function like so:



FTransform UDQBlueprintFunctionLibrary::GetBoneTransFromMontage(UAnimMontage* InMontage, FName BoneName, float InTime)
{    
    FTransform transform = FTransform();
    if (InMontage)
    {
        int bone_index = 0;

        USkeletalMesh* SkelMesh = InMontage->GetSkeleton()->GetPreviewMesh(true);
        if (SkelMesh)
        {
            bone_index = SkelMesh->RefSkeleton.FindBoneIndex(BoneName);
            UAnimSequence* Anim = Cast<UAnimSequence>(InMontage->SlotAnimTracks[0].AnimTrack.AnimSegments[0].AnimReference);

            if (bone_index >= 0)
            {
                Anim->GetBoneTransform(transform, bone_index, InTime, true);
            }
        }
    }
    return transform;
}


It’s a bit shorter. Might be helpful?

1 Like