Hopefully I’m just having a senior moment and have missed something simple. I have a character that is not moving, but he is playing an animation all the time. On some input, like a touch, he needs to do a couple different things and then go back to the default looping animation.
I have a FBX from Maya that I’m Splitting the animations. alwaysplaying 1-35, firstAnim 40-52, secondAnim 60-70.
Animations are Store in Root and Animation Compression is off. With this script I have it almost working, all except for the firstAnim CrossFade. If I simply Play the triggered animation it plays, but has a jerky transition since things don’t match up. If I change it to Additive like the secondAnim, things go too far.
The comments are some of my unsuccessful attempts.
function Start(){
animation.wrapMode = WrapMode.Loop;
animation["alwaysplaying"].layer= 1;
animation["alwaysplaying"].speed = 1;
animation["firstAnim"].layer = 2;
animation["secondAnim"].layer = 3;
animation["secondAnim"].wrapMode = WrapMode.Clamp;
animation["secondAnim"].blendMode = AnimationBlendMode.Additive;
animation["firstAnim"].blendMode = AnimationBlendMode.Blend;
animation["firstAnim"].wrapMode = WrapMode.Clamp;
}
function Update () {
if (Input.GetButtonDown ("Jump")) animation.Play("firstAnim");//animation.CrossFadeQueued("firstAnim");//animation.CrossFade("firstAnim");
if (Input.GetButtonDown ("Fire1")) animation.Play("secondAnim");//animation.CrossFadeQueued("secondAnim");
//animation.CrossFade("alwaysplaying");
}
Any ideas how I can get the CrossFade to work? Thanks!