Merge pull request #50363 from JestemStefan/node2D_zero_scale_det_error

Limit scale of `Node2D` to EPSILON (0.00001) to prevent `det==0` error
This commit is contained in:
Rémi Verschelde 2021-08-12 15:40:11 +02:00 committed by GitHub
commit f54c5707b5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -170,10 +170,10 @@ void Node2D::set_scale(const Size2 &p_scale) {
}
_scale = p_scale;
// Avoid having 0 scale values, can lead to errors in physics and rendering.
if (_scale.x == 0) {
if (Math::is_zero_approx(_scale.x)) {
_scale.x = CMP_EPSILON;
}
if (_scale.y == 0) {
if (Math::is_zero_approx(_scale.y)) {
_scale.y = CMP_EPSILON;
}
_update_transform();