Forums › 💬 Slate Sequencer › 🤩 Custom Clips › Spine Animation Track › Reply To: Spine Animation Track
Hi Gavalakis,
Made some progress on this. A user on the Spine Forums called Boboshu posted some code that seems to get animation blending working. Posting here for your reference – hope that’s ok. This is the change to the UpdateClip method:
|
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 |
public void UpdateClip(PlaySpineAnimationClip clip, float time, float previousTime, float weight){ if (spineComponent != null){ //baseWeight = activeClips == 2? 0 : 1 - weight; //clip.clipAnimation.Apply(skeleton, 0, time, true, null, weight * this._weight, Spine.MixPose.CurrentLayered, Spine.MixDirection.In); //fix spine 3.6 mix bug 2018.9.16 //by boboshu if( skeletonAnimation == null) skeletonAnimation = spineComponent as SkeletonAnimation; var toAnimation = clip.clipAnimation; // Approximate what AnimationState might do at runtime. if (activeClips > 1 && fromAnimation != null) { skeleton.SetToSetupPose(); fromAnimation.Apply(skeleton, 0, fromTime, true, null, fromWeight, MixPose.Setup, MixDirection.Out); toAnimation.Apply(skeleton, 0, time, true, null, weight, MixPose.Current, MixDirection.In); } else { skeleton.SetToSetupPose(); toAnimation.PoseSkeleton(skeleton, time, true); } fromAnimation = clip.clipAnimation; fromTime = time; fromWeight = weight; } } |
Also need to add these variables:
|
1 2 3 4 5 6 7 8 9 10 11 |
[System.NonSerialized] private SkeletonAnimation skeletonAnimation; [System.NonSerialized] private Spine.Animation fromAnimation; [System.NonSerialized] private float fromTime; [System.NonSerialized] private float fromWeight; |
and in OnInitialize()
skeletonAnimation = actor.GetComponent<SkeletonAnimation>();
Link to original post: http://esotericsoftware.com/forum/Unity-Slate-ith-Spine-3-6-mix-bug-please-help-10825
