Ok, my situation.
I have an animation (of my character swinging a hammer). Near the end of the animation, i have an animation event. This fires off a function which sets a specific variable (“canAttack”) to true, thusly allowing more swings to be done, if the user clicks again
The idea here is that the point where i consider the attack “finished” is not the same as the end of the animation, and this allows me to seperate those two concepts.
What i intend is that if the user does not swing the hammer again, then the character slowly and smoothly transitions back to an idle pose. And i’d like that slow transition to be interruptible at any time, with a new swing.
The problem right now is, as soon as the animation event hits, the animation ends and goes back to the neutral state immediately, with a transition that looks unnaturally fast. Basically here’s not a ransition at all, it just teleports from one pose to the other
Here’s how my animator is setup. The states swing and hold are what’s important (hold is a statemachine, although it currently contains only the single substate Hammer)
Now what i’ve found is, a slow transition, the one i desire and want to see, DOES happen if the following are true:
- The transition from swing to hold “has exit time”
- The value of the exit time is set to happen BEFORE the animation event is triggered
- No parameter checking condition is set on the transition
Under these conditions, the animation will slowly transition to the holding stance depending on the transition time i set, BUT this also prevents the transition from being interrupted by a new swing.
If i set the exit time after the event, slow transition doesn’t happen, i’ve no idea why.
The main thing the animation does is set the boolean “canAttack” to true. If i add the condition “canAttack = true” then the transition doesn’t work
HOWEVER, if i set the condition “canAttack == false”, and disable the exit time then the slow transition does happen. But with the same problem as above (the animation event isn’t called until the transition ends)
So, the slow transition ALSO works in the following circumstance:
- The parameter checking condition “canAttack == false” is set
2a. Exit time is set on the animation, at a time before the anim event occurs
OR
2b: Exit time is not set on the animation
But again, the transition cannot be interrupted with a new swing, and the logic for it working does not make sense.
This is confusing me
What logic dictates should happen, and what i’d like it to do, is to set an exit time after the event, to set the condition “canAttack == true”, and for the slow transition to thusly happen after he animation event has triggered and set canAttack to true.
I cannot find any state where a check for “canAttack == true” causes the slow transition to happen.
I realise this thread is very convoluted. What could i provide to demonstrate the issue?