mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-26 22:49:01 +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;
|
ty = targetY - bone.worldY;
|
||||||
break;
|
break;
|
||||||
case noRotationOrReflection:
|
case noRotationOrReflection:
|
||||||
rotationIK += atan2(pc, pa) * radDeg;
|
float s = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
||||||
float ps = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
float sa = pa / bone.skeleton.scaleX;
|
||||||
pb = -pc * ps;
|
float sc = pc / bone.skeleton.scaleY;
|
||||||
pd = pa * ps;
|
pb = -sc * s * bone.skeleton.scaleX;
|
||||||
|
pd = sa * s * bone.skeleton.scaleY;
|
||||||
|
rotationIK += atan2(sc, sa) * radDeg;
|
||||||
// Fall through.
|
// Fall through.
|
||||||
default:
|
default:
|
||||||
float x = targetX - p.worldX, y = targetY - p.worldY;
|
float x = targetX - p.worldX, y = targetY - p.worldY;
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user