I know that I can use layers to set animation prirority and AddMixingTransform to just set animate some parts of a mesh. Unfortunately, it doesn't really work. Everytime I want to crossfade to the walkanimation(that just animates the legs) it also fades the idle animation out but it should keep playing "Idle" and should just overwrite the animation of the legs. What is wrong with the script? I can't find something I miss there
void Start () {
Animationen["Idle"].layer = 2;
Animationen["Walk_Weapon"].layer = 2;
Animationen["Walk_Weapon"].AddMixingTransform(RightLeg, true);
Animationen["Walk_Weapon"].AddMixingTransform(LeftLeg, true);
}
// Update is called once per frame
void Update () {
//Walk
if (Input.GetAxis("Vertical") > 0.2)
{
Animationen["Walk_Weapon"].speed = 1.5F;
Animationen.CrossFade("Walk_Weapon");
}
//Idel
if (Input.GetAxis("Vertical") == 0 && Input.GetAxis("Horizontal")==0)
{
if (IsWeaponMode())
Animationen.CrossFade("Idle_Weapon");
else
Animationen.CrossFade("Idle");
}
}