I wanted to create a new topic because the previous one may have became complicated with a lot of questions.
I got 2 questions about the anim state graph that I could not solve.
Is it possible to use exit time in transitions when you use the ANY state in the state graph? When I link from the ANY state I cannot get the exit time to work between individual transitions. See the below images of what I mean, I want to use the ANY state because otherwise i need to link lots of arrows between states to and from each other.
How does interruption source work? I could not find much detail about that in the materials. Does that mean I can cancel a current animation and play another? so if i shoot i can cancel the currently playing reload animation? If so how could I get this to work?
Have you set up a condition on the ANY > Idle transition which can be used to control when the graph transitions back to Idle? Otherwise it’ll always be available, keeping it in the Idle state.
With regards to interruption sources: By default transitions cannot be interrupted (i.e once the graph enters into a transition, that transition will fully complete before the graph can transition again). If you set the interruption source of a transition, you’re telling the graph which other transitions can interrupt the current one.
For instance if you have a graph with Idle > Walk > Run and an interruption source of none on all of your transitions, you’ll need to wait for the transition from Idle > Walk to complete before you can transition from Walk > Run. However if you set the interruption source of the Idle > Walk transition to next, you’ll be able to activate a transition from Walk > Run while the Idle > Walk transition is currently playing.
To add a second solution, if you did want to use the ANY state, you’d need to keep the reload boolean to true while you’re in the reload state, then set conditions on the ANY > Walk & ANY > Idle transitions which check that reload is false. Like @yaustar mentioned, this would be gating your transitions with conditionals.
Additionally: in my code looks like I forgot to add the check for activeState === ‘Reload’ because sometimes the animation would not play after pressing R.