Ver Fonte

[c][cpp] Fix for #2412

Mario Zechner há 1 ano atrás
pai
commit
501ad3553d

+ 2 - 2
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);

+ 2 - 2
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);