Hi there!
I'm having a good time working with Spine on Unity3d. The docs have some outdated lines, but they're very clear and straight on Spine's workflow.
There's just an issue I would like to ask help with. I'm using a character with various layered animations. Like:
a first layer for aiming a weapon (I'm not using IK or anything, just pure animation).
a second layer for the legs movement. Walking, iddle, etc.
a third layer for facial expressions.
I would like to override these animations in some special cases, like, for example, when the character dies. I'm not worried about mixing between animations (actually, I prefer not to use mixing at all).
Just to state again, I would like to just play an animation at once, overriding all the previous animations, on all the layers they are happening.
On the code part, this is what I'm using to play a layered animation:
skeletonAnimation.AnimationState.SetAnimation(layer, nextAnimation, loop);
And, for trying to play an entire new animation, overriding everything before... this was my attempt:
for(int i = 0; i < trackEntries.Length; i++) {
//I've kept stored the track entries on an Array
if (trackEntries[i] != null) {
trackEntries[i].TrackTime = trackEntries[i].AnimationEnd;
trackEntries[i].Loop = false;
//trackEntries[i].Interrupt();
}
}
skeletonAnimation.skeleton.SetBonesToSetupPose();
trackEntries[0] = skeletonAnimation.AnimationState.SetAnimation(0, aniName, false);
trackEntries[0].TrackTime = 0.01f;
I think the for loop is not the ideal, but it was part of my attempts to override everything.
There's something I'm not getting yet?