Fix android-specific rotation issue. bone->arotation == NaN, in some specific cases during update bones, cause squared value can been very smoll but still negative anyway and create NaN value (#2459)

This commit is contained in:
Dmitriy Sechin 2024-03-06 04:29:25 +02:00 committed by GitHub
parent f4c0f64f0d
commit 0ffc316793
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -246,8 +246,9 @@ void spIkConstraint_apply2(spBone *parent, spBone *child, float targetX, float t
r0 = q / c2; r0 = q / c2;
r1 = c0 / q; r1 = c0 / q;
r = ABS(r0) < ABS(r1) ? r0 : r1; r = ABS(r0) < ABS(r1) ? r0 : r1;
if (r * r <= dd) { y = dd - r * r;
y = SQRT(dd - r * r) * bendDir; if (y > 0) {
y = SQRT(y) * bendDir;
a1 = ta - ATAN2(y, r); a1 = ta - ATAN2(y, r);
a2 = ATAN2(y / psy, (r - l1) / psx); a2 = ATAN2(y / psy, (r - l1) / psx);
goto break_outer; goto break_outer;