How to interrupt looping animation while allowing it to complete current iteration

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By Swander

Hello, thank you for checking this question.

The project is set up in the next way:
I’m working on a 2.5D character controller and i have stumbled uppon one issue. To animate my character i am using AnimationNodeBlendTree. My goal is to make my character play looping bounce animation when he is moving and stop it otherwise. The problem is that when stopping bounce animation amidst it playtime the character ends up in the wrong position(ex. above ground). I would like to allow this bounce animation to finish its current loop and only then stop it.

I already came up with a solution but it certainly leaves more to desire.
Here is a screenshot of a current sollution using AnimationNodeBlendTree :
enter image description here
To control when to play bounce animation i can modify “blend” property of Add2(add_bounce_all). When it’s set to one it plays looping bounce_envoker animation which animates the “on” property of OneShot(shot_bounce). And even when “blend” property is set to zero it doesn’t interrupt the current iteration ofa bounce animation.

Like i said the utilised solutions is not the most optimal in my opinion, as it requires animation which changes AnimationNodeBlendTree properties thus cluttering character animation list.
Here is a minimal project with this solution: google drive link

This would be great if you could provide other ways to accomplish this!

:bust_in_silhouette: Reply From: scrubswithnosleeves

Answering this live on stream: https://www.youtube.com/watch?v=fC3384meGZA

Should be at the 1 hour mark.

Cool! Will definitely check it out

Swander | 2021-06-14 14:23