Rapid State Switching


This is a bit of an odd one and on me i'm sure, but i'm building a custom animator for AI bit by bit and when switching to a crouched state via height change, the dude seems to rapidly pop between the standing animations or the standing idle as they move. I'm including a video of the behavior and the anim controller itself. I've gone through and adapted/copied alot of the different transition conditions, and the behavior works on the ufps demo unit carrying out the same behavior via an AI script, there's just something about the controller i've built that just isn't doing what it should. Normally i'd just keep at this myself, but given that it's wrapped up in the ability system i'm really not sure what to do here.

Apologies for the choppiness, got alot goin' on on dif screens.

In the video, the bouncing gasmmaskman and the crouched Nolan are using the same ai script.

i'm sure it's something to do with some anystate transition I've mucked up, but i can't find the problem area.

I've taken control of it myself, and the behavior is consistent. Sometimes the Ability Change parameter seems to get stuck, or not change until i move for a bit.

I've also seen that the anim never finishes playing, it LOOKS like the state anim plays about halfway through then transitions out a dif one, always getting halfway then stopping. it LOOKS like it's doing tht "transition to self" stuttering but it's not as those are all unchecked, and more or less are the same values in the sameplaces that the demo use has, no idea why this transition is so rapidly borked.

I haven't added the leg index to any of these, largely given that i don't understand it yet and was gonna mess with it later, but could the leg index not being there have antyhing to do with it?

Here's a link to the controller, no idea if ya'll can use it but here it is regardless.


Staff member
Hi @LethDavidson! Sorry you've been running into issues with that, thanks for sending the video and controller that helped a lot.

It looks like your transitions to the crawling movement are all good with the abilityindex set to 3. I think the only change you would need to make is specifying an abilityindex for regular movement. The animator is switching between the two because the conditions for regular movement still apply so it can't decide which one to stay on.

If you look at the demo controller for Idle/Movement I have the abilityindex set to 0. If the animator is in a different ability it would not go to the regular movement animations.

The leg index would not effect this but if you have any questions on that let me know. That is used for transitioning between different movement type animations so that the right and left leg are always lined up as much as they can be in the cycle.

Hope this helps!
That def sounds like it could be it, tho i admit to not actually being sure how to define the abiltiy index for just regualr movemnet, so i'm not sure how to change it TO 0. I tried setting the AbilityIndex on the navmesh/A* navigation ability to 0, but that doesn't seem to change anything. and I double checked and yeah, all my idle stuff has "if abilityindex = 0" in it's conditions. I had assumed that regualr movment, bar any ability, would set the ability index to 0.

is this something i need to change in the locomotion handler? am i just missing something in the animator that lets me define that? cuz i'm really not seeing a difference in the animator itself between the functional demo and my nonfunctional version.

I def appreciate the help, hopefully it's just some simple thing i'm still missing.
WAIT fuck fuck wait fuck i got it, i was stupid,aaaaaa.
Yeah you were right, i realize i'd never actually pout in that "only go to STANDINGmovmenet when ability index is at 0" condition. I thought i did, but looking closeer i put in the AbilityIntData and not ability index. So yeah, it was bopping between the standing and crouch cuz it thought both were valid. I must have been very tired to miss that after scanning this thing for hours.

It works great! And this most certainly has taught me a thing or two about the system. Thank you very much, it took me a bit to figure out exactly what ya meant but that was on me. Thank you!


Staff member
Awesome! Glad to hear it is working now! Yeah it can get confusing between AbilityIndex and AbilityIntData.

It is automatically AbilityIndex = 0 when an ability isn't active so that should always be true when it should be in regular movement.