I’m making a 2.5d platformer brawler in the style of super smash bros and I will need to use either the root motion in mecanim or something similar hacked onto the legacy system.
I have tried quite a few different ways of getting root motion to work with the legacy system, but none of them seemed to work particularly well. I’m using non kinematic rigidbody physics by the way. I’ve found that the mecanim animation system’s Root Motion works quite well, but the mecanim state machine seems mortally opposed to doing what its told.
What I’ve done is set up my animator controller with a single Int parameter (called State) so that every state has a single transition coming out of Any State under the condition that the State parameter is equal to a specific number. Instead of calling CrossFade(“animation”) like I used to, now I call SetInteger(stateParameterHash, index) where index is the number that will trigger that transition (then I set State back to -1 in LateUpdate).
My problem is that the animations don’t always play when I tell them to. I can be falling and touch the ground, but it will still be playing the falling animation. Or I can be standing idle and start moving but it won’t play the idle animation, no matter how much I start and stop moving until I jump and hit the ground again. Its definitely not a problem with my state machine because literally the only thing that has changed is the way I tell it what animation to play.
I’ve set all of the transitions to be non-atomic which should mean they can be interrupted, but I’m a little unclear on that. I read a post somewhere that it only lets them be interrupted by a transition higher in the list, which would make it entirely useless for what I want.
If I’m falling, land, start running, crouch and then jump all in quick succession, why can’t mecanim go falling->land->idle->run->crouch->jump exactly as I tell it to? Either I’m doing something astoundingly wrong or mecanim really is as bad as I make it out to be. I sincerely hope its the first option because I don’t fancy having to go back to the legacy system and dicking around to get root motion working, so can anyone think of what I might be doing wrong?
[16159-state+machine.png|16159]