diff --git a/spine-c/spine-c/src/spine/IkConstraint.c b/spine-c/spine-c/src/spine/IkConstraint.c index 7ce325d8c..4f0fa257a 100644 --- a/spine-c/spine-c/src/spine/IkConstraint.c +++ b/spine-c/spine-c/src/spine/IkConstraint.c @@ -80,8 +80,8 @@ void spIkConstraint_apply1(spBone *bone, float targetX, float targetY, int /*boo switch (bone->data->transformMode) { case SP_TRANSFORMMODE_ONLYTRANSLATION: - tx = targetX - bone->worldX; - ty = targetY - bone->worldY; + tx = (targetX - bone->worldX) * SIGNUM(bone->skeleton->scaleX); + ty = (targetY - bone->worldY) * SIGNUM(bone->skeleton->scaleY); break; case SP_TRANSFORMMODE_NOROTATIONORREFLECTION: { s = ABS(pa * pd - pb * pc) / MAX(0.0001f, pa * pa + pc * pc); diff --git a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp index ac865f111..bf667d6b7 100644 --- a/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp +++ b/spine-cpp/spine-cpp/src/spine/IkConstraint.cpp @@ -47,8 +47,8 @@ void IkConstraint::apply(Bone &bone, float targetX, float targetY, bool compress switch (bone._data.getTransformMode()) { case TransformMode_OnlyTranslation: - tx = targetX - bone._worldX; - ty = targetY - bone._worldY; + tx = (targetX - bone._worldX) * MathUtil::sign(bone.getSkeleton().getScaleX()); + ty = (targetY - bone._worldY) * MathUtil::sign(bone.getSkeleton().getScaleY()); break; case TransformMode_NoRotationOrReflection: { float s = MathUtil::abs(pa * pd - pb * pc) / MathUtil::max(0.0001f, pa * pa + pc * pc); diff --git a/spine-flutter/CHANGELOG.md b/spine-flutter/CHANGELOG.md index c962b75c9..0929f26fb 100644 --- a/spine-flutter/CHANGELOG.md +++ b/spine-flutter/CHANGELOG.md @@ -1,5 +1,10 @@ # 4.2.18 * Fixes compilation errors due to API change in Flutter 3.16.0, see [this issue](https://github.com/EsotericSoftware/spine-runtimes/issues/2420). **Note**: Depending on this version requires your project to depend on Flutter >= 3.16.0 as well. +# 4.1.10 +# Update WASM binaries + +# 4.1.9 +# Fixes #2412, single bone, translation only IK constraints did not take skeleton scale into account. # 4.1.8 * Fixes compilation errors due to API change in Flutter 3.16.0, see [this issue](https://github.com/EsotericSoftware/spine-runtimes/issues/2420). **Note**: Depending on this version requires your project to depend on Flutter >= 3.16.0 as well. diff --git a/spine-haxe/spine-haxe/spine/IkConstraint.hx b/spine-haxe/spine-haxe/spine/IkConstraint.hx index 937d0a416..1e86eea00 100644 --- a/spine-haxe/spine-haxe/spine/IkConstraint.hx +++ b/spine-haxe/spine-haxe/spine/IkConstraint.hx @@ -95,8 +95,8 @@ class IkConstraint implements Updatable { ty:Float = 0; switch (bone.data.transformMode) { case TransformMode.onlyTranslation: - tx = targetX - bone.worldX; - ty = targetY - bone.worldY; + tx = (targetX - bone.worldX) * MathUtils.signum(bone.skeleton.scaleX); + ty = (targetY - bone.worldY) * MathUtils.signum(bone.skeleton.scaleY); case TransformMode.noRotationOrReflection: var s = Math.abs(pa * pd - pb * pc) / Math.max(0.0001, pa * pa + pc * pc); var sa:Float = pa / bone.skeleton.scaleX; 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 ef8192f08..c4d6be61f 100644 --- a/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java +++ b/spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/IkConstraint.java @@ -191,8 +191,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); diff --git a/spine-ts/spine-core/src/IkConstraint.ts b/spine-ts/spine-core/src/IkConstraint.ts index de5045a63..9fc98ff63 100644 --- a/spine-ts/spine-core/src/IkConstraint.ts +++ b/spine-ts/spine-core/src/IkConstraint.ts @@ -122,8 +122,8 @@ export class IkConstraint implements Updatable { switch (bone.data.transformMode) { case TransformMode.OnlyTranslation: - tx = targetX - bone.worldX; - ty = targetY - bone.worldY; + tx = (targetX - bone.worldX) * MathUtils.signum(bone.skeleton.scaleX); + ty = (targetY - bone.worldY) * MathUtils.signum(bone.skeleton.scaleY); break; case TransformMode.NoRotationOrReflection: let s = Math.abs(pa * pd - pb * pc) / Math.max(0.0001, pa * pa + pc * pc);