Skip to content

Commit

Permalink
[ts] Port of commit 877e705. Fix NaN in IKConstraint due to fp precis…
Browse files Browse the repository at this point in the history
…ion.
  • Loading branch information
davidetan committed Aug 7, 2024
1 parent 877e705 commit e4df0c0
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions spine-ts/spine-core/src/IkConstraint.ts
Original file line number Diff line number Diff line change
Expand Up @@ -270,8 +270,9 @@ export class IkConstraint implements Updatable {
q = -(c1 + q) * 0.5;
let r0 = q / c2, r1 = c / q;
let r = 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);
break outer;
Expand Down

0 comments on commit e4df0c0

Please sign in to comment.