Randomly choosing idle animations

Hello,

I've built my own animation controller based on the demo controller and my idle state has 6 idle animations to pick from. I have the Max Ability Float Data Value set to 5 (6 animations but zero-based), I de-normalized the threshold values in the blend tree, and everything works for the most part. The idle animations get sorted through randomly, which I like.

The only thing I think I'm misunderstanding is the min/max timing in the Idle ability. It seems like it's designed to play each idle animation for a random amount of time before setting the Ability Float Data Value to a new random number. The random animation part makes sense, but why do we play them for random amounts of time? Why not just play each one to completion and then pick a new one? I only ask because my idle animations appear to transition from one to another rather abruptly.

If I'm understanding that correctly, I think if I were to try and change the Idle ability to pick random animations but to play each to completion, the easiest way might be with animation events which call public methods in my Idle ability class to switch the Ability Float Data Value to a new random value. Am I understanding the Idle ability correctly, and does my solution make sense?

Thanks!
 
You are understanding the ability correctly. The idle animations that we have aren't too different from each other so it makes transitioning easy within the blend tree. If your animations are more different from each other then using an event will work well.

It's also great to see that you're creating the animator controller from scratch.. that demo controller is starting to get pretty large and would have a lot of extra states that you don't necessarily need for your game
 
Hey thanks!

I'm taking a crack at editing the Idle ability to accommodate animation events in the different idle animations as discussed. It should just be a matter of adding the AnimationEventTrigger field and registering the IdleAnimChangeEvent to the scheduler, right? It doesn't seem like I would need to edit the Ability base class or anything like that.

Although I'm a little unsure of how to link my animation event to the code that changes my Ability Float Data Value.
 
Hmm sorry, I may need to ask for a hand on this. Thought I had the chops to code this myself but I'm a little confused.

I've got events at the ends of all my idle animations which I've called "IdleAnimChangeEvent" for now. I've got an AnimationEventTrigger in the Idle Ability with the tooltip indicating the IdleAnimChangeEvent.

Just trying to essentially duplicate the logic within DetermineAbilityFloatDataValue( ) but only when this animation event is triggered. Many thanks for any tips on this one.
 
After the event is received you'll want to do a:

Code:
m_CharacterLocomotion.UpdateAbilityAnimatorParameters();

This will then update the parameters on the animator since the values aren't fetched every frame.
 
Hmm sorry, I may need to ask for a hand on this. Thought I had the chops to code this myself but I'm a little confused.

I've got events at the ends of all my idle animations which I've called "IdleAnimChangeEvent" for now. I've got an AnimationEventTrigger in the Idle Ability with the tooltip indicating the IdleAnimChangeEvent.

Just trying to essentially duplicate the logic within DetermineAbilityFloatDataValue( ) but only when this animation event is triggered. Many thanks for any tips on this one.

If you had any success in setting it up the way you described, could you explain it to a moron like me? ?


I have a limited understanding of animation events... For example, I don't understand the terminology, where you wrote, "I've got an AnimationEventTrigger in the Idle Ability with the tooltip indicating the IdleAnimChangeEvent."
 
Top