- Düzenlendi
Preview editor/Runtime won't mix negative to positive scale
Hey all I am having an issue with the Spine editor and Runtime. I'm using Spine 4.0.64.
What's happening: Candy Cane flipping (not mixing) from positive to negative scale.
What should be happening: Candy Cane should mix smoothly from positive to negative scale.
What really should be happening: Candy cane mixing positive to negative scale should not differ from how it functions using keys. It's inconsistent logic that is very confusing.
In the example file I have 3 animations.
- Negative_Scale
- Positive_Scale
3.Positive_To_Negative
in the first animation I have 1 frame of the candy cane at -1 scale.
in the second animation I have 1 frame of the candy cane at 1 scale.
in the third animation I have it transitioning in a loop from positive to negative.
If you use the preview editor(also happens in the runtime) and change back and forth from Negative_Scale to Positive_Scale the candy cane will just snap from positive to negative. There is no mixing happening.
Why is this happening? Is this a bug? Is it a math issue? What are ways around this?
I may have made a candy cane as an example but this applies to a characters hair when I want her to transition to a run cycle. She has 2 pony tails facing opposite directions when she is in the idle anim but when she transitions to running I make her face more profile. What this should do to her hair is make both pony tails face the same direction. This is only possible using scale. Yes you can rotate her hair to face the same direction but that is physically not how it would happen. In the real world it would invert visually. I understand that when going from negative to positive it will go past 0 and when it does that the image disappears due to 0 width. That's okay to me because I have workarounds for that. The functionality of Spine should be logical and not use assumptions to determine how a feature will work. Scaling from negative to positive using mixing should work how you expect it to. I did not expect it to just snap like it was from Spine 2.0.
Does anyone know what I am talking about and how to solve it?
Apologies to my blunt approach but I do mean well and have a lot of respect for Spine and all the developers. Thanks!
It's late here, but I believe this is by design. Consider when you are using negative scale to flip a character, then you mix another animation that doesn't flip the character. If it interpolates in a way that the scale crosses zero, your character would become thin like a piece of paper. I understand that is probably what you are looking for, but in many cases it's unwanted.
This not illogical, it just might not be what you expected. If you had the other use case and didn't want your character to flip over like a piece of paper, then you would probably appreciate the behavior and not want it changed. It's a drawback that comes from scale being used for the direction things are facing and also for scaling.
We have chosen the behavior that is desired most often and unfortunately there isn't an easy workaround to get the other behavior. You could modify the runtimes so the scale timelines work like you want. It's not a huge change and we can help you to do that, if you want to go that route. Relevant code is here:
https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/Animation.java#L807
Hey Nate! Thanks for the post and the solution you've provided. I appreciate your explanation even if I don't necessarily agree with it. I think an option to choose either option per skeleton would be really cool.