# How to check if animation has finished?

**URL:** <https://forums.unrealengine.com/t/how-to-check-if-animation-has-finished/341076>\
**Category:** Character & Animation\
**Tags:** unreal-engine, skeletalmesh, question\
**Created:** [December 10, 2015, 6:27pm UTC](https://forums.unrealengine.com/t/how-to-check-if-animation-has-finished/341076 "2015-12-10T18:27:47Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Rijke](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rijke](https://forums.unrealengine.com/u/Rijke)\
**Post date:** [December 10, 2015, 6:27pm UTC](https://forums.unrealengine.com/t/how-to-check-if-animation-has-finished/341076/1 "2015-12-10T18:27:47Z")

</div>

Hi! I am playing an animation on a skeletal mesh component by using the following code:

```
m_pMesh->PlayAnimation(s_pAnimJump, 0);

```

where m\_pMesh is of type USkeletalMeshComponent\* and s\_pAnimJump is of type UAnimSequence\*.

This plays the animation perfectly! But I would like to know when the jump animation has finished so that I can play the free-fall animation. Does anyone know how to find the remaining time?

Thanks!

---

<div class="post-metadata">

**Author:** ![Rijke](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rijke](https://forums.unrealengine.com/u/Rijke)\
**Post date:** [December 11, 2015, 2:18am UTC](https://forums.unrealengine.com/t/how-to-check-if-animation-has-finished/341076/2 "2015-12-11T02:18:05Z")

</div>

There is a method called IsPlaying() in USkeletalMeshComponent that will tell you if any animation is currently playing.

---

<div class="post-metadata">

**Author:** ![rantrod](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@rantrod](https://forums.unrealengine.com/u/rantrod)\
**Post date:** [December 11, 2015, 3:03am UTC](https://forums.unrealengine.com/t/how-to-check-if-animation-has-finished/341076/3 "2015-12-11T03:03:54Z")

</div>

m\_pMesh-\>PlayAnimation(s\_pAnimJump, 0);  
float animLen = m\_pMesh-\>GetSingleNodeInstance()-\>GetLength();

If you wait for the animation to end, and then play the other, you’ll get a little hitch, so I would take a bit of time off:

```
animLen -= 0.34f;

```

Now you can set a timer or something to kick off the next step. For example:

```
GetWorldTimerManager().SetTimer(PostAnimTimerHandle, this, &MyActor::PostAnimFunc, animLen, false);

```

I recommend that instead of using m\_pMesh-\>PlayAnimation(s\_pAnimJump, 0); you use:

```
float animLen = m_pMesh->GetAnimInstance()->Montage_Play(MyMontage);

```

Because montages have the nice blend-in, blend-out feature, return the anim length right off the bat, and have many convenience functions such as pause and skip to section. If you don’t want a hitch between animations, simply account for the blend-out time.

```
animLen -= MyMontage->BlendOutTime;

```

---

<div class="post-metadata">

**Author:** ![Rijke](https://d3kjluh73b9h9o.cloudfront.net/original/4X/2/8/5/28502927f1d97ba1051b3b47ccfe17233bf41ef0.png) [@Rijke](https://forums.unrealengine.com/u/Rijke)\
**Post date:** [December 11, 2015, 3:57am UTC](https://forums.unrealengine.com/t/how-to-check-if-animation-has-finished/341076/4 "2015-12-11T03:57:17Z")

</div>

Ah, I couldn’t find GetSingleNodeInstance. I didn’t realize it was referring to an animation instance. I will check out montages because the blending will probably look much nicer than a snappy animation change. Thank you so much for taking the time to reply to my question! You have helped me so much.
