- Home /
Mecanim smooth transition from arbitrary time in animation
Hello
I've been trying to make a smooth blending from one animation to another from any point in time. What I have is the following: One attack which should combo into another attack. This is currently done in mecanim by setting a trigger to transition to the next attack instead of to the exit node. Now this works really well as long as the player presses the combo button before the transition's Exit Time is reached. However to keep a nice feeling the animations have some lag at the end before the character will either follow up with another attack or return to the idle state.
Ideally a player would be able to queue up the next attack at any time during the animation before the animation starts returning to the character's idle state. So if the player pressed the button early, the animation would transition as soon as possible, but if the player pressed during the lag part of the animation, the next attack would be slightly delayed instead.
The problem in mecanim is that if the Exit Time is passed, which is currently at the start of the lag time of the character, it is not possible to transition smoothly anymore. Currently the only solution i found was to force the animation the Play function but this obviously results in broken animations since it's not smoothed/blended anymore.
Answer by theANMATOR2b · Dec 23, 2017 at 08:20 PM
The problem is you need two outcomes with a IF statrment. Two outcomes - both instant transition (has exit time) and a queue wait for animation end (no exit time).
This is an interesting problem.
Could your current set up add a variable - if input is given within X seconds = instantly transition OR if input happens after X seconds = wait for current animation to end then transition to next queued animation.
This is plane language because Im not a programmer.
I could certainly do that but the fluidity would be lost. Waiting for the entire animation to end would make the input far less responsive compared to starting a transition instantly upon input (if the animation has proceeded far enough). In short I need more than an IF statement; a potential transition for every single frame, or maybe even more than that. Currently I'm doing what you suggest, transition with exit time if input is given early enough or doing an instant transition if the exit time has been passed, but the animations are quite jerky doing that.
Your answer
Follow this Question
Related Questions
How to stop mesh disappearing during Animator state transition blend time? 1 Answer
What are those white curves in the animation transition panel - And can I read it in script? 0 Answers
Mecanim - How to use "Exit Time" for a state that uses negative speed (anim playing backwards)? 2 Answers
Combining two animations to be one 0 Answers