Using the USpineSkeletonRendererComponent or USpineSkeletonAnimationComponent, how can I get access to the TrackEntry for the currently playing animation, in blueprints? Neither of these components have AnimationState members.
How to get TrackEntry (Animstate) from the playing animation?
To get the TrackEntry
for the currently playing animation using USpineSkeletonRendererComponent
or USpineSkeletonAnimationComponent
in blueprints, you can use the GetCurrent
function of the AnimationState
to query the TrackEntry
at a given track index. Here is how you can do it:
- Open the Blueprint where you have your
USpineSkeletonRendererComponent
orUSpineSkeletonAnimationComponent
. - Select the Skeleton Animation Component on your actor.
- Drag off the Skeleton Animation Component and search for the
Get Animation State
node. - Drag off the Animation State and search for the
Get Current
node. - Specify the Track Index for which you want to get the
TrackEntry
. - Use the TrackEntry to get the currently playing animation.
Here is a step-by-step visual guide:
Open the Blueprint:
Select the Skeleton Animation Component:
Drag off the Skeleton Animation Component and search for
Get Animation State
.Drag off the Animation State and search for
Get Current
.Specify the Track Index:
UTrackEntry* entry = animationComponent->GetAnimationState()->GetCurrent(trackIndex);
Use the TrackEntry to get the currently playing animation:
if (entry != nullptr) { FString animationName = entry->Animation->Name; // Do something with the animation name }
This approach allows you to access the TrackEntry
and query the currently playing animation in blueprints.
No, AnimationState is not part of SkeletonMeshComponent, that is my entire problem.