Hi, I have an avatar controller which handles some animations (walk, idle, jump, salute).
I want to salute while I’m idle or walking so the way I’m doing it is:
public Transform mixBone;
animations[walk.name].layer = -1;
animations[idle.name].layer = -2;
animations.SyncLayer(-1);
animations[walk.name].normalizedSpeed = 1;
animations[jump.name].layer = 5;
animations[jump.name].wrapMode = WrapMode.ClampForever;
animations.SyncLayer(5);
animations[salute.name].layer = 5;
animations[salute.name].wrapMode = WrapMode.Once;
animations[salute.name].blendMode = AnimationBlendMode.Blend;
animations[salute.name].AddMixingTransform(mixBone);
And then this is my update():
if(!motor.IsMoving())
{
animations.Blend(walk.name, 0.0f, 0.3f);
animations.CrossFade(idle.name);
}
else
animations.CrossFade(walk.name,0.3f);
}
}
And…
void DidSalute()
{
animations.Blend(salute.name,1);
}
Which is called when an input key is pressed.
I don’t know why… but it seems that salute is executed but it’s overrided by the walk/idle animation and the salute animation doesn’t finish.
Maybe because of the Update() crossfade¿?
EDIT:
It works with BlendMode.Blend.
http://unity3d.com/support/documentation/Manual/Character-Animation.html
http://unity3d.com/support/documentation/ScriptReference/Animation.html