Browse Source

Revert "[csharp] Fix of incorrect bugfix commit f5fb9b5a. Fixed IK constraint NaN when a parent bone has zero scale."

This reverts commit fb59ba45b31bf8507e72134adec67c2740c40b44.
Harald Csaszar 2 năm trước cách đây
mục cha
commit
463e18596c
1 tập tin đã thay đổi với 2 bổ sung6 xóa
  1. 2 6
      spine-csharp/src/IkConstraint.cs

+ 2 - 6
spine-csharp/src/IkConstraint.cs

@@ -182,9 +182,7 @@ namespace Spine {
 			}
 			default: {
 				float x = targetX - p.worldX, y = targetY - p.worldY;
-				float d = pa * pd - pb * pc;
-				if (d > 0) d = Math.Max(0.0001f, d);
-				else d = Math.Min(-0.0001f, d);
+				float d = Math.Max(0.0001f, pa * pd - pb * pc);
 				tx = (x * pd - y * pb) / d - bone.ax;
 				ty = (y * pa - x * pc) / d - bone.ay;
 				break;
@@ -258,9 +256,7 @@ namespace Spine {
 			b = pp.b;
 			c = pp.c;
 			d = pp.d;
-			float id = a * d - b * c, x = cwx - pp.worldX, y = cwy - pp.worldY;
-			if (id > 0) id = 1 / Math.Max(0.0001f, id);
-			else id = 1 / Math.Min(-0.0001f, id);
+			float id = 1 / Math.Max(0.0001f, a * d - b * c), x = cwx - pp.worldX, y = cwy - pp.worldY;
 			float dx = (x * d - y * b) * id - px, dy = (y * a - x * c) * id - py;
 			float l1 = (float)Math.Sqrt(dx * dx + dy * dy), l2 = child.data.length * csx, a1, a2;
 			if (l1 < 0.0001f) {