This question has to do with how combining layers, cross fade, and weight effects an animation.
Introduction Topic: Animation Scripting
Scenario
Clip: Idle
- Default Clip
- Looping
- Default Layer
Clip: Wave
- Non-looping
- Not assigned to animation object.
About 5 seconds into the simulation, the following code is run:
mAnimation.AddClip(waveClip, mClipName);
mAnimation[mClipName].layer = 100;
mAnimation.CrossFade(mClipName, 1.0f);
As expected, the wave clip fades in from 0 to 100% over 1 second, then fades back out. The idle animation continues un-interuped.
The Unexpected
Same scenario, except with the following code:
mAnimation.AddClip(waveClip, mClipName);
mAnimation[mClipName].layer = 100;
mAnimation[mClipName].weight = 0.5f; // <- Changed here.
mAnimation.CrossFade(mClipName, 1.0f);
What I expect is the same behavior, except that the wave clip will fade in from 0 to 50%.
What is actually happening is that it fades in from 50 to 100%, so I get a sudden snap at the beginning of the crossfade.
Question
Is this behaving as expected? If so, what is the logic behind this behavior? And what should I do if I really want to fade in from 0 to 50%?