I have created an animation blueprint where I have Death state - simply death animation from animation starter pack. And I want the animation to play and when it ends, I want it to stop. How can I stop the animation at it’s last frame?
I have tried many things I found on the internet, but the don’t work or I don’t understand how to do it.
I don’t know if it’s the best way, but you can add an Animation Notify at the end of your animation (you may want to add it a few frames before the actual end) and in the Animation Blueprint you can add an event for that notify that stops the animation. I’ve done it for an attack animation and it works really well.
You can find out more about Animation Notifies in this tutorial:
I tried that, but I don’t know how to connect it all and make it work. But I will spend more time to learn that.
As for now I created new state with Single Frame Animation and as a rule I took ratio of remaining previous animation and check if it’s smaller than 0.1. That works, but I hoped to be able to achieve it in better way.
Thank you for answer.
You probably want to do an AnimMontage or in your StateMachine make a state after your “dying” state that is “dead” and transition to that state once the dying animation is done playing.
Probably the latter.
I have done that, but I thought there is some better way to achieve that. I hoped that I can simply call some “StopAnimation” function and stop it.
As I wrote in comment above:
As for now I created new state with Single Frame Animation and as a rule I took ratio of remaining previous animation and check if it’s smaller than 0.1. That works, but I hoped to be able to achieve it in better way.
Thank you for answer.
That tutorial series have very useful information in regards to that. I’ll try and share my blueprints later, I hope that’ll help.
A “StopAnimation” function is essentially what that is. Why do you think a different way would be better?
If it is in an animation state, the answer is quite simple. To stop an animation in its last frame, you click on the state of the animation you want. Click on the animation and in the Details panel, you will find a Loop box under variables, with a pin box on the left. Simply uncheck the loop box, so when the animation ends, it will stop for good. Hope this solves it for you! I tend to use this with any single-use animations, such as death, jump start/ends, etc - - to try and aim for a more precise transition between animations. Hope this solved it for you!
That was exactly what I was looking for. Thank you!
Not sure if this is the best fix when you want a random death animation based on AnimGraph, otherwise there is always a switch back to the default idle position from your blend space.
Upon identifying the health dropping to 0, you could simply do a montage choosing a random integer in range based on the number of death animations.
You mean outside of the AnimGraph? Nope, that does not work, after the montage the character will switch back to the blendspace idle position, even if movement is removed, destroyed or disabled.
Not if you set the montage to loop the last frame.
How can you set the last frame looping? Can you post a screenshot?
Make a new montage section, click on the montage section labeled as 1 in the picture, followed by clicking on the montage labeled 2. It will turn the section 1 blue with an X after it, indicating a loop.
Thanks, will use this next time, or when i revisit the issue.
I was struggling with this and I found a solution here: