Hmm
So I guess the question is: should 'setuppose' in apply mixing from be true for Animations with mix time 0.
our repo was:
Setup pose - ik mix = 100
Play Animation which keys mix to 0 frame 0
Interrupt that animation with animation which DOES NOT key the mix, (it keys the transform or ik)
The ik mix is still 0.
Should it be 100 because that is what it is in setup pose?
I have confirmed that atleast 3 animations need to have been played. just playing two animations, do not seem to recreate the bug.
https://drive.google.com/file/d/0B5ElW0WUt28eWFVpcXNnTXF4TFU/view?usp=sharing
Ok. I have reduced the problem into its simplest form. Above is a unity project (sorry nate, its the easiest way of showing you the problem) with the issue (please note all playing of animations is done within the IKBug.cs
file).
Within the project there is a modified Goblins.spine
file. With 2 animations. The first animation Anim1
keys the IK mix to 0. The second animation Anim3
(sorry about the name), doesn't key anything.
The following code is what happens to the animation state, with animations being set. If you are unfamiliar with co-routines, yield return null
means wait one frame - Although it is possible for this bug to happen at different stages of animations, its hard to reliable timing for that.(if it loops maybe?) .
private IEnumerator PlaySpinAnimation()
{
yield return new WaitForSeconds(0.5f);//Wait for a second to start playing the animation
//Anim1: Keys IK to 100
//Anim3: empty animation - no keys
//True - IK Mix will end up as 0
//False - IK Mix will end up as 100
#if true
m_Animation.state.SetAnimation(0, "Anim1", true);
yield return null;
m_Animation.state.SetAnimation(0, "Anim1", true);
yield return null;
m_Animation.state.SetAnimation(0, "Anim3", true);
yield return null;
#else
m_Animation.state.SetAnimation(0, "Anim1", true);
yield return null;
m_Animation.state.SetAnimation(0, "Anim3", true);
yield return null;
#endif
Debug.Log(m_Animation.skeleton.ikConstraints.Items[0].mix);
}
setting the #if
to True
, will make the IK Mix
= 0. Setting it to False
results in IK Mix
= 100.
Some notes:
Setting the default mix to >0, results in IK Mix
= 1, no matter which code path.
#if true
m_Animation.state.SetAnimation(0, "Anim1", true);
yield return null;
the yield return null;
here (and only here) can be replaced with yield return new WaitForSeconds(10 // doesnt matter what this time is.
As it does not matter how long before the second animation, Anim1
started.
I play Anim1
twice, but it doesn't matter what anim plays, so long as it keys the IK off
:smoke: