• Bugs
  • Local + Relative Transform Constraints problem

I'm not sure if it's a bug, maybe it should work like this by design, but it would be good if someone clarify it, here is what I do:
1) Create a Transform Constraint
2) Set it to be Local and Relative
3) Set a Rotate Mix to 100%
Result: Rotation Mix works fine, but from now on constrained bone's local Scale doesn't influence a bone. I tested it in Spine 4.0.26 and in Spine Unity Runtime 4.0-2021-08-16

My conjecture: I checked a Spine Unity Runtime Github, here is a part of ApplyRelativeLocal method of TransformConstraint class from Spine 3.7 Runtime [https://github.com/EsotericSoftware/spine-runtimes/blob/3.7/spine-csharp/src/TransformConstraint.cs] :

...
float scaleX = bone.ascaleX, scaleY = bone.ascaleY;
if (scaleMix != 0) {
    scaleX *= ((target.ascaleX - 1 + data.offsetScaleX) * scaleMix) + 1;
    scaleY *= ((target.ascaleY - 1 + data.offsetScaleY) * scaleMix) + 1;
}
...

And the corresponding part of the code from Spine 4.0 Runtime [https://github.com/EsotericSoftware/spine-runtimes/blob/4.0/spine-csharp/src/TransformConstraint.cs]

...
float scaleX = (bone.ascaleX * ((target.ascaleX - 1 + data.offsetScaleX) * mixScaleX) + 1);
float scaleY = (bone.ascaleY * ((target.ascaleY - 1 + data.offsetScaleY) * mixScaleY) + 1);
...

So my guess is that there could be a typo and it should be something like this instead:

...
float scaleX = bone.ascaleX * (((target.ascaleX - 1 + data.offsetScaleX) * mixScaleX) + 1);
float scaleY = bone.ascaleY * (((target.ascaleY - 1 + data.offsetScaleY) * mixScaleY) + 1);
...
Related Discussions
...

You let us know what the problem is AND the line of code causing the problem AND the fix. You, kind sir, win user of the month! :beer:

You're right, we've now fixed it in all runtimes and it'll be in 4.0.27. Thanks!

Nate wrote

You let us know what the problem is AND the line of code causing the problem AND the fix. You, kind sir, win user of the month! :beer:

You're right, we've now fixed it in all runtimes and it'll be in 4.0.27. Thanks!

Thank you!