Hi.
I'm making character animation in several layers, but I can't make work `AnimationBlendMode.Additive`. Using `AnimationBlendMode.Blend`, animations gets played (but obviously I can't add them).
I think I managed to make it work in earlier tests, but now I'm really stuck with this. I think it could be related to the mesh export-import process (Blender) or so.
I'll include the code and the complete test project.
I'll appreciate any help
// This code illustrates my inability to get Add two animations.
// The intention is to have a face abled to gesture with the
// various parts (mouth, eyes, nose, etc..) independently.
// I try to reach this with several layers (two in this test)
// one on each part of the face, so that the animations of each
// part can be mixed without interfering with others.
// Just push '2' after start
// The idea is to push '1' to return to netural expression
// (but it doesn't work)
var status = "" ;
function Start () {
animation.wrapMode = WrapMode.ClampForever ;
}
function Update () {
if (Input.anyKeyDown) { tecla = Input.inputString.ToUpper() ;
switch (tecla) {
case "1": INIT ( ) ; break ;
case "2": MIX ( ) ; break ;
default: break ;
}
}
}
function INIT () {
animation.Stop();
status = "Stop" ;
}
function MIX () {
status = "Mixing" ;
// First layer. A smile in the mouth
animation["mouthsmile"].layer = 0 ;
animation["mouthsmile"].blendMode = AnimationBlendMode.Blend ;
animation["mouthsmile"].weight = 1.0;
animation.CrossFade("mouthsmile" , 0.7 , PlayMode.StopSameLayer) ;
// Instead of .CrossFade() it could be .Play(),
// so we don't need any blending yet
// Second layer. Eyes closed
animation["eyesclosed"].layer = 1 ;
// AnimationBlendMode.Additive AnimationBlendMode.Blend
animation["eyesclosed"].blendMode = AnimationBlendMode.Additive ;
// This should be should be additive, because we want to
// preserve the anims.-gestures of the other layers
animation["eyesclosed"].weight = 1.0;
animation.Sample() ; // ...give flying blind. When nothing works...
animation.CrossFade("eyesclosed" , 0.7 , PlayMode.StopSameLayer) ;
}
// SOME RESOURCES
// animation["mouthsmile"].time = 1.0 ;
// animation[animLayer1mixA].normalizedTime = 1.0 ;
// animation[animLayer1mixA].enabled = true;
// animation.Play(animLayer0mixA) ;
// animation.Blend(animLayer0mixA , 0.7 ) ;
// animation.Blend(animLayer1mixA , 0.7 ) ;