mirror of
https://github.com/EsotericSoftware/spine-runtimes.git
synced 2025-12-20 09:16:01 +08:00
[csharp] Fix of incorrect bugfix commit f5fb9b5a. Fixed IK constraint NaN when a parent bone has zero scale.
This commit is contained in:
parent
6f63f76600
commit
fb59ba45b3
@ -182,7 +182,9 @@ namespace Spine {
|
||||
}
|
||||
default: {
|
||||
float x = targetX - p.worldX, y = targetY - p.worldY;
|
||||
float d = Math.Max(0.0001f, pa * pd - pb * pc);
|
||||
float d = pa * pd - pb * pc;
|
||||
if (d > 0) d = Math.Max(0.0001f, d);
|
||||
else d = Math.Min(-0.0001f, d);
|
||||
tx = (x * pd - y * pb) / d - bone.ax;
|
||||
ty = (y * pa - x * pc) / d - bone.ay;
|
||||
break;
|
||||
@ -256,7 +258,9 @@ namespace Spine {
|
||||
b = pp.b;
|
||||
c = pp.c;
|
||||
d = pp.d;
|
||||
float id = 1 / Math.Max(0.0001f, a * d - b * c), x = cwx - pp.worldX, y = cwy - pp.worldY;
|
||||
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 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) {
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user