Add a special case for 0-time interpolations

(cherry picked from commit 5c1195e456)
This commit is contained in:
kobewi 2021-09-17 00:50:07 +02:00 committed by Rémi Verschelde
parent e2b2319ee5
commit e0f46c2b38
No known key found for this signature in database
GPG Key ID: C3336907360768E1
1 changed files with 4 additions and 0 deletions

View File

@ -312,6 +312,10 @@ Tween::interpolater Tween::interpolaters[Tween::TRANS_COUNT][Tween::EASE_COUNT]
};
real_t Tween::_run_equation(TransitionType p_trans_type, EaseType p_ease_type, real_t t, real_t b, real_t c, real_t d) {
if (d == 0) {
// Special case to avoid dividing by 0 in equations.
return b + c;
}
interpolater cb = interpolaters[p_trans_type][p_ease_type];
ERR_FAIL_COND_V(cb == NULL, b);