Răsfoiți Sursa

[csharp] Port of commit 853b5ee. Fix NaN in IKConstraint due to fp precision.
dd - r * r might result in a negative value, even if dd == r * r, depending on compiler optimizations and operation order.

Harald Csaszar 1 an în urmă
părinte
comite
b17595db8a
2 a modificat fișierele cu 2 adăugiri și 2 ștergeri
  1. 1 1
      spine-csharp/src/IkConstraint.cs
  2. 1 1
      spine-csharp/src/package.json

+ 1 - 1
spine-csharp/src/IkConstraint.cs

@@ -328,7 +328,7 @@ namespace Spine {
 					q = -(c1 + q) * 0.5f;
 					q = -(c1 + q) * 0.5f;
 					float r0 = q / c2, r1 = c / q;
 					float r0 = q / c2, r1 = c / q;
 					float r = Math.Abs(r0) < Math.Abs(r1) ? r0 : r1;
 					float r = Math.Abs(r0) < Math.Abs(r1) ? r0 : r1;
-					if (r * r <= dd) {
+					if (dd - r * r >= 0) {
 						y = (float)Math.Sqrt(dd - r * r) * bendDir;
 						y = (float)Math.Sqrt(dd - r * r) * bendDir;
 						a1 = ta - (float)Math.Atan2(y, r);
 						a1 = ta - (float)Math.Atan2(y, r);
 						a2 = (float)Math.Atan2(y / psy, (r - l1) / psx);
 						a2 = (float)Math.Atan2(y / psy, (r - l1) / psx);

+ 1 - 1
spine-csharp/src/package.json

@@ -2,7 +2,7 @@
 	"name": "com.esotericsoftware.spine.spine-csharp",
 	"name": "com.esotericsoftware.spine.spine-csharp",
 	"displayName": "spine-csharp Runtime",
 	"displayName": "spine-csharp Runtime",
 	"description": "This plugin provides the spine-csharp core runtime.",
 	"description": "This plugin provides the spine-csharp core runtime.",
-	"version": "4.2.28",
+	"version": "4.2.29",
 	"unity": "2018.3",
 	"unity": "2018.3",
 	"author": {
 	"author": {
 		"name": "Esoteric Software",
 		"name": "Esoteric Software",