given a bone by name/index and an animation I’d like to know the time/frame when that bone is on its lowest/highest position in World Space. I’d like to add notifies at those frames. This could happen at Runtime, e.g. on BeginPlay().
I know that animations are driven by bone rotations and forward kinematics. I’ve looked into USkinnedMeshComponent, USkeletalMeshComponent and it’s children and UAnimationAsset and it’s children. I can collect the transform data for every bone by iterating through the animation, but I’m missing the part to transform it into World Space afterwards.
You can create AnimationThumbnailSkeletalMeshActor. This blueprint has Get Bone Pose for Time/Frame for any animation. also you gonna convert bone transform from component space to world space. You can add each frame data to array and calculate what do you want.
That’s what I already could do in C++, I’ll get an array of transforms that holds the rotation of the bone for the given Frame ( since location to parent is constant). The rotation is given in bone space, relative to its parent. But I’d like to have a location in component space, I’m missing the transformation. I assume I Need the transforms of every parent bone too.
I implemented it the following way in pseudocode :
LowestPosition ( AnimSequence, Bone )
Transforms]; // the array we store all transforms in
foreach( frame in AnimSequence.Frame )
ParentBone = Bone.Parent
Pose = GetBonePoseForFrame(AnmSequence, Bone, frame)
while (ParentBone is not null)
Pose = Pose x GetBonePoseForFrame(AnimSequence,ParentBone,frame)
ParentBone = ParentBone.Parent
end while
Transforms.Add(Pose)
end for
return index of (min( z € Transforms.Z))
It seems to work, though I don’t if I’m doing it correctly. Can anyone confirm?