- Home /
Animations wont CrossFade
I have a combo system and I am recommending my animators to have one continuous attack instead of different separate attacks that all return to idle, then breaking them apart so that they can be linked if the player continues the attack. This plan can only work however if the animations CrossFade back to the idle pose. I have an idle animation and the animations are longer than 0.3 seconds. For some reason, Attack2 does not want to CrossFade and it just jumps abruptly to the idle animation. Does anybody know why this is happening? Is this an issue with 3ds Max or with something I'm doing with the programming?
bump, I could really use some help here.
I'm calling animations from two different scripts and the second one is using transform.parent.GetComponent() to control the animations, does accessing the component from two different skips affect any?
Edit: I just tested it and it doesn't seem to matter if call the animations from two different scripts. It just calls the same stuff.
Answer by save · Sep 20, 2011 at 12:48 AM
Have you tried setting the animations to theAnimation.blendMode = AnimationBlendMode.Additive;
? Also try to put them in different layers to separate the motions.
Make sure to use animation.CrossFade("the animation", crossfadeTime);
on them while an attack goes on and return to an idle state (still using CrossFade).
Thanks for the help. What exactly does Additive do? I tried it and the attack animation just goes nuts and becomes a giant mess with the bones just going in all kind of crazy directions.
Also, how does the crossfadeTime help? There is a quick snapping when I CrossFade like there is no blend at all, maybe it's happening too fast?
Ok, I just played around with the CrossFade crossfadeTime, and it works with other stuff and I definitely see the effect. However, in my case, there just isn't any kind of blend at all, so no matter how long I make the CrossFade, it just snaps back to the idle animation.
The bit you said about "while an attack goes on" is what I didn't realize I was doing wrong. Obviously the animation has to be playing for it to CrossFade, my animations were stopped before the CrossFade was being called. I'll figure it out from here, thanks.
Answer by Stardog · Jun 21, 2013 at 12:54 PM
You need to set the animation to Loop, or it won't CrossFade.
Even if it's an attack animation that has a finite length, you still have to set it to Loop.
You will have to manually jump to a previous state by checking the "animation[animAttack.name].length", then end it manually when the 1st loop is finished using WaitForSeconds.
Your answer
Follow this Question
Related Questions
Crossfade Quickening 0 Answers
More Animations = More Screwed Up? 0 Answers
Revert back to Idle animation Smoothly 0 Answers
Play an animation just on some parts of the body 1 Answer
Shaking skinned mesh animations 1 Answer