[libgdx] Take skeleton scale into account when applying translation only IK constraint, see #2412

This commit is contained in:
Mario Zechner 2023-11-28 13:25:06 +01:00
parent ab92e26ca8
commit c11afb283d

View File

@ -182,8 +182,8 @@ public class IkConstraint implements Updatable {
float rotationIK = -bone.ashearX - bone.arotation, tx, ty;
switch (bone.data.transformMode) {
case onlyTranslation:
tx = targetX - bone.worldX;
ty = targetY - bone.worldY;
tx = (targetX - bone.worldX) * Math.signum(bone.skeleton.scaleX);
ty = (targetY - bone.worldY) * Math.signum(bone.skeleton.scaleY);
break;
case noRotationOrReflection:
float s = Math.abs(pa * pd - pb * pc) / Math.max(0.0001f, pa * pa + pc * pc);