Random Idle Animations

Hi,

My animated character is working but, but I have multiple idle/run blendspace 1D and I’m trying to get my default animation graph inside my Animation Blueprint to randomly select the multiple idle/run blendspaces and then select another one once that one ends. But I am uncertain where to start with this in my animation blueprint. Any suggestions on randomizing the idle blendspaces?

How I did that, at the end of in each animation I added “IdleEnd” notify. In Animgraph i call that notify and generate random number in range “0-all animations I have”. Then in Idle state use Blend Pose by Int and feed it the generated number.

Well you can start by adding a “Blend by Int” to your AnimGraph and create a Integer var, call it something like random, and plug that into the var input of the Blend by Int. In the event graph create a random number generator along with a delay so that a new value is generated, based on the number of takes in the BBI, and resets the “random” value and a new take is then played each time the delay is reset.

Do you mean the “Blend Poses by Int”? This takes two values, “Blend Time” as a float, and “Active Child Index” as a int. I’m assuming the random number variable generated by my Event Graph will go into the “Active Child Index?” and the Blend Time is only to set how long it takes to blend from one pose to the next?

I had originally tried with just a “Blend” and my int converted into a float, plugged into the Alpha. My animation works but instantly popped to the next pose. Your suggestion seems promising. Will try. Thanks!

UPDATED:
I tested this out. It works well! Though it appears Im limited to just two blends using “Blend by Int”. I didn’t see an option to add more. What if I had like 10 idle animations I want to blend?

Right click on the node and select “Add Blend Pin”

Wanted to add a picture, but I failed :smiley:

I guess it’s been a while since I’ve done the same process. Setting up the Anmgraph is easy enough but with out the delay the idle will be reset on the tick. To have the random cycle play throught a few times you need to break the event graph into two requirements. 1) set up the random number generator behind a “do once” node so a random number is only generated once. 2) set up a delay loop in front of the “do once” that whey the full delay is reached the “do once” is reset generating a new random number.

If you want the loop to play longer just make the delay longer :wink:

That works! You rock. Thanks buddy!

Thanks again!!

Hello! Did you mean that you call that notify in Event Graph? Because in Unreal Engine 4.24.3 I can’t seem to call that notify in the AnimGraph, but only in the Event Graph…