Is there any way to restore visibility settings if an animation is stopped early? Say I key an attachment in the middle of a walk cycle and then put it back at the end. But then the player jumps in the middle of the walk cycle and is left with the wrong attachment visible. I could just key it back at the beginning of the jump animation but there's potentially many animations that could cancel the walk cycle.
Canceling animations with keyed attachments
- Modifié
Sure, but put it back to what attachment? The easiest solution is to call
setSlotsToSetupPose
when changing the animation. Alternatively or additionally, you could set the attachment for the slots you want to reset. Eg, if your character can have many different swords and attachment changes are keyed in the animation, setSlotsToSetupPose
is probably not what you want and you would explicitly set the sword the player has equipped.
If you are using mix times, the AttachmentTimeline of the animation you are mixing from may change attachments after you have changed the animation and reset the attachments. This post describes one solution to that problem:
One Frame Attachment Animations
This issue tracks the problem (#12) and a number of other use cases and improvements we have planned:
[runtimes] AnimationState improvements · Issue #621 · EsotericSoftware/spine-runtimes · GitHub