• RuntimesUnreal
  • How to get TrackEntry (Animstate) from the playing animation?

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.

Related Discussions
...

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:

  1. Open the Blueprint where you have your USpineSkeletonRendererComponent or USpineSkeletonAnimationComponent.
  2. Select the Skeleton Animation Component on your actor.
  3. Drag off the Skeleton Animation Component and search for the Get Animation State node.
  4. Drag off the Animation State and search for the Get Current node.
  5. Specify the Track Index for which you want to get the TrackEntry.
  6. Use the TrackEntry to get the currently playing animation.

Here is a step-by-step visual guide:

  1. Open the Blueprint:
    Open the Blueprint

  2. Select the Skeleton Animation Component:
    Select the Skeleton Animation Component

  3. Drag off the Skeleton Animation Component and search for Get Animation State.

  4. Drag off the Animation State and search for Get Current.

  5. Specify the Track Index:

       UTrackEntry* entry = animationComponent->GetAnimationState()->GetCurrent(trackIndex);
  6. 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.

    JuiceTin
    Nevermind, in Unreal AnimationState is not needed. You can call GetCurrent straight from SkeletonAnimationComponent. 🙂