mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2026-03-06 18:56:54 +08:00
[lua] Fix 1-bone IK, see #1692.
This commit is contained in:
parent
c64e6adbde
commit
dcc6925e90
@ -102,10 +102,14 @@ function IkConstraint:apply1 (bone, targetX, targetY, compress, stretch, uniform
|
|||||||
tx = targetX - bone.worldX
|
tx = targetX - bone.worldX
|
||||||
ty = targetY - bone.worldY
|
ty = targetY - bone.worldY
|
||||||
elseif bone.data.transformMode == TransformMode.noRotationOrReflection then
|
elseif bone.data.transformMode == TransformMode.noRotationOrReflection then
|
||||||
rotationIK = rotationIK + Math.atan2(pc, pa) * MathUtils.radDeg
|
local s = math_abs(pa * pd - pb * pc) / (pa * pa + pc * pc);
|
||||||
local ps = Math.abs(pa * pd - pb * pc) / (pa * pa + pc * pc)
|
local sa = pa / bone.skeleton.scaleX;
|
||||||
pb = -pc * ps
|
local sc = pc / bone.skeleton.scaleY;
|
||||||
pd = pa * ps
|
pb = -sc * s * bone.skeleton.scaleX;
|
||||||
|
pd = sa * s * bone.skeleton.scaleY;
|
||||||
|
rotationIK = rotationIK + math_deg(math_atan2(sc, sa));
|
||||||
|
|
||||||
|
|
||||||
local x = targetX - p.worldX
|
local x = targetX - p.worldX
|
||||||
local y = targetY - p.worldY
|
local y = targetY - p.worldY
|
||||||
local d = pa * pd - pb * pc
|
local d = pa * pd - pb * pc
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user