From e0ee18a0880cf48f4f8cb68e381de6d7e2fd8378 Mon Sep 17 00:00:00 2001 From: NathanSweet Date: Sat, 25 Jun 2016 22:13:31 +0200 Subject: [PATCH] Fixed single bone IK mixing. --- .../src/com/esotericsoftware/spine/IkConstraint.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java index 50dd12514..58e99dd18 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java @@ -130,13 +130,13 @@ public class IkConstraint implements Updatable { float id = 1 / (pp.a * pp.d - pp.b * pp.c); float x = targetX - pp.worldX, y = targetY - pp.worldY; float tx = (x * pp.d - y * pp.b) * id - bone.x, ty = (y * pp.a - x * pp.c) * id - bone.y; - float rotationIK = atan2(ty, tx) * radDeg - bone.shearX; + float rotationIK = atan2(ty, tx) * radDeg - bone.shearX - bone.rotation; if (bone.scaleX < 0) rotationIK += 180; if (rotationIK > 180) rotationIK -= 360; else if (rotationIK < -180) rotationIK += 360; - bone.updateWorldTransform(bone.x, bone.y, bone.rotation + (rotationIK - bone.rotation) * alpha, bone.scaleX, bone.scaleY, - bone.shearX, bone.shearY); + bone.updateWorldTransform(bone.x, bone.y, bone.rotation + rotationIK * alpha, bone.scaleX, bone.scaleY, bone.shearX, + bone.shearY); } /** Adjusts the parent and child bone rotations so the tip of the child is as close to the target position as possible. The