mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-02-06 15:24:55 +08:00
Fixed 1-bone IK for transform mode noRotationOrReflection when skeleton scale is applied.
This commit is contained in:
parent
bcfff2d3c8
commit
5cab7e9460
@ -185,10 +185,12 @@ public class IkConstraint implements Updatable {
|
||||
ty = targetY - bone.worldY;
|
||||
break;
|
||||
case noRotationOrReflection:
|
||||
rotationIK += atan2(pc, pa) * radDeg;
|
||||
float ps = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
||||
pb = -pc * ps;
|
||||
pd = pa * ps;
|
||||
float s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
||||
float sa = pa / bone.skeleton.scaleX;
|
||||
float sc = pc / bone.skeleton.scaleY;
|
||||
pb = -sc * s * bone.skeleton.scaleX;
|
||||
pd = sa * s * bone.skeleton.scaleY;
|
||||
rotationIK += atan2(sc, sa) * radDeg;
|
||||
// Fall through.
|
||||
default:
|
||||
float x = targetX - p.worldX, y = targetY - p.worldY;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user