I’m having problem with root motion when applying a masked layer.
The rig is generic. Root motion in walk anim.
I move it in script, using the workaround for a know bug where animator.deltaPosition is always 0,0,0:
void OnAnimatorMove()
{
// Because of bug in mecanim with generic rig.
delta = animator.rootPosition - transform.position;
agent.velocity = delta / Time.deltaTime;
}
All this works fine, but then I added a new layer. Made a bone mask where I only selected the few bone that should be affected. Added 1 animation to this layer. (Bow head down) Looped.
When I run the game, and drag the weight slider in the layer, the character starts to slow down in forward motion and finally stops as weight reaches 1. The character is now walking on the spot with head down, like expected, but no root motion any more.
The question is: Have I done something wrong or is this a bug?
I’ve also tried adding the same mask (as the one in the layer) to the animation. I’ve tried baking root motion and not, for my head bow anim. No help. Also checked if animator.deltaPosition maybe had some data now, but no.