- Home /
What is the proper way to blend between two Mecanim States in a Layer, when both animation clips have different Masks?
Thanks for the help in advance. This is the first time when rigorous Google and Unity forum searching has not given me any kind of answer.
The Scenario:
I have two Layers in Mecanim. Layer 0 contains all everyday full-body animations (idle, running, dodging, etc). Layer 1 is an Override layer which has the things that appear over top of a character, which overrides all or some of the animations underneath (blocking, hand gestures, etc). Some clips like blocking have leg motions masked out so you can still run. Others, like hand motions, have all but the arm masked out so you can wave to friends while doing anything else.
The Problem:
During transitions between two states in Layer 1 (Override Mask Layer), and ONLY during transitions, any parts of my character armature that use a Mask on EITHER state where the masks don't identically match...slowly transition into the Base Pose (T-Pose) of the armature. When the transition completes, the character snaps to his properly masked pose.
So, an example: if a Hand Wave animation has everything masked out but the arm/hand/fingers, and I try to transition into a base Idle pose with nothing masked, everything but the arm will snap to Base Pose (T-Pose) and transition into the Idle from there. The other way around (Idle->Wave), the character will transition from Idle to T-Pose (except the arm, again), then when the transition ends, snap to where he ought to be in his Hand Wave animation.
Keep in mind, this only occurs when two animation clips do not have the same parts masked. Any parts that are both either MASKED or UNMASKED do what they ought to.
Also, I cannot use Avatar Masks because in [Override] Layer 1, the same parts won't always be masked. Hence the problem.
The Solution?
I understand that you can't transition from a keyframe to an absent keyframe, if that's what masks actually are. Yet when the transition completes, the character's parts are in their proper place, so I know that works. How can I transition into that proper place?
I've tried cracking this many more times over the last month, still having difficulty with this problem. I'm eager to hear about workarounds, even, if there is no solution.
Answer by drolak · Oct 07, 2015 at 12:08 PM
I had similar problems when my clips didn't animate some curves or simply when had states without animation. There's this "write defaults" checkbox on the animation state.
From the docs: Write Defaults Whether or not the AnimatorStates writes back the default values for properties that are not animated by its Motion.
Did you try to uncheck it?
Your answer
Follow this Question
Related Questions
Mecanim- change Layer mask at runningTime 0 Answers
Dealing with multiple crosshairs 0 Answers
Layer hidden in Scene view, visible in game 3 Answers
Detecting that I'm clicking a unit even though I'm not? 0 Answers
LayerMask is incorrect 1 Answer