Skip to content

Commit

Permalink
[haxe] Port of commit 877e705. Fix NaN in IKConstraint due to fp prec…
Browse files Browse the repository at this point in the history
…ision.
  • Loading branch information
davidetan committed Aug 7, 2024
1 parent e4df0c0 commit ec52a4f
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions spine-haxe/spine-haxe/spine/IkConstraint.hx
Original file line number Diff line number Diff line change
Expand Up @@ -288,8 +288,9 @@ class IkConstraint implements Updatable {
q = -(c1 + q) / 2;
var r0:Float = q / c2, r1:Float = c / q;
var r:Float = Math.abs(r0) < Math.abs(r1) ? r0 : r1;
if (r * r <= dd) {
y = Math.sqrt(dd - r * r) * bendDir;
r0 = dd - r * r;
if (r0 >= 0) {
y = Math.sqrt(r0) * bendDir;
a1 = ta - Math.atan2(y, r);
a2 = Math.atan2(y / psy, (r - l1) / psx);
breakOuter = true;
Expand Down

0 comments on commit ec52a4f

Please sign in to comment.