Kaynağa Gözat

Mix transform constraint scale and shear offsets.

NathanSweet 9 yıl önce
ebeveyn
işleme
55f6db3af9

+ 6 - 6
spine-libgdx/spine-libgdx/src/com/esotericsoftware/spine/TransformConstraint.java

@@ -71,12 +71,12 @@ public class TransformConstraint implements Updatable {
 		if (scaleMix > 0) {
 			float bs = (float)Math.sqrt(bone.a * bone.a + bone.c * bone.c);
 			float ts = (float)Math.sqrt(target.a * target.a + target.c * target.c);
-			float s = (bs > 0.00001f ? (bs + (ts - bs) * scaleMix) / bs : 0) + offsetScaleX;
+			float s = (bs > 0.00001f ? (bs + (ts - bs + offsetScaleX) * scaleMix) / bs : 0);
 			bone.a *= s;
 			bone.c *= s;
 			bs = (float)Math.sqrt(bone.b * bone.b + bone.d * bone.d);
 			ts = (float)Math.sqrt(target.b * target.b + target.d * target.d);
-			s = (bs > 0.00001f ? (bs + (ts - bs) * scaleMix) / bs : 0) + offsetScaleY;
+			s = (bs > 0.00001f ? (bs + (ts - bs + offsetScaleY) * scaleMix) / bs : 0);
 			bone.b *= s;
 			bone.d *= s;
 		}
@@ -84,14 +84,14 @@ public class TransformConstraint implements Updatable {
 		if (shearMix > 0) {
 			float b = bone.b, d = bone.d;
 			float by = atan2(d, b);
-			float r = (atan2(target.d, target.b) - atan2(target.c, target.a)) - (by - atan2(bone.c, bone.a));
+			float r = atan2(target.d, target.b) - atan2(target.c, target.a) - (by - atan2(bone.c, bone.a));
 			if (r > PI)
 				r -= PI2;
 			else if (r < -PI) r += PI2;
-			r = by + r * shearMix;
+			r = by + (r + offsetShearY * degRad) * shearMix;
 			float s = (float)Math.sqrt(b * b + d * d);
-			bone.b = cos(r + offsetShearY * degRad) * s;
-			bone.d = sin(r + offsetShearY * degRad) * s;
+			bone.b = cos(r) * s;
+			bone.d = sin(r) * s;
 		}
 
 		float translateMix = this.translateMix;