Play random animation with chances

Hello hello there.

I want to be able to select a random animation from a set of animations, each having their own seperate chance of being selected.

The Random Sequence Node would have been good for this, but this node doesn’t support input pins, which doesn’t let me use it for my use cases. I need to be able to specify the animations it can choose from since I want to make it re-usable through an Animation Template.

Does anyone know any solutions worth looking into?

Here’s a tutorial :innocent:

1 Like

Thank you for the response!

I ended up looking at this tutorial but it didn’t quite offer what I needed it to do. I wanted to have a “weight” to all of the random options, so we could for example have a animation that only rarely plays.

I eventually decided to go for a different approach. I made a struct containing an Animation Sequence and an integer for the weights. I then pass Data Assets containing arrays of this struct to the Animation Template and query them using Property Acces. Then I link a randomly selected value of this array to the sequencer when a transition becomes relevant.

1 Like

You can make an array of animations and use a random integer in range node when you get (a copy), or just use the Select node by pulling off “Animation to Play”, and populate it like an array, and again for the index use random integer in range.

I hope that helps!