Skip to content

Commit

Permalink
[libgdx] Fixed noRotationOrReflection with skeleton scale.
Browse files Browse the repository at this point in the history
  • Loading branch information
NathanSweet committed Aug 29, 2024
1 parent 70be289 commit d769c1a
Showing 1 changed file with 6 additions and 7 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -153,11 +153,12 @@ public void updateWorldTransform (float x, float y, float rotation, float scaleX
break;
}
case noRotationOrReflection: {
float sx = 1 / skeleton.scaleX, sy = 1 / skeleton.scaleY;
pa *= sx;
pc *= sy;
float s = pa * pa + pc * pc, prx;
if (s > 0.0001f) {
s = Math.abs(pa * pd - pb * pc) / s;
pa /= skeleton.scaleX;
pc /= skeleton.scaleY;
s = Math.abs(pa * pd * sy - pb * sx * pc) / s;
pb = pc * s;
pd = pa * s;
prx = atan2Deg(pc, pa);
Expand Down Expand Up @@ -441,10 +442,8 @@ public void updateAppliedTransform () {
switch (inherit) {
case noRotationOrReflection: {
float s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
float sa = pa / skeleton.scaleX;
float sc = pc / skeleton.scaleY;
pb = -sc * s * skeleton.scaleX;
pd = sa * s * skeleton.scaleY;
pb = -pc * skeleton.scaleX * s / skeleton.scaleY;
pd = pa * skeleton.scaleY * s / skeleton.scaleX;
pid = 1 / (pa * pd - pb * pc);
ia = pd * pid;
ib = pb * pid;
Expand Down

0 comments on commit d769c1a

Please sign in to comment.