summaryrefslogtreecommitdiff
path: root/scene
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <remi@verschelde.fr>2021-08-12 15:40:11 +0200
committerGitHub <noreply@github.com>2021-08-12 15:40:11 +0200
commitf54c5707b5d2f77a7d112c1cf5c2494751e0dace (patch)
treee9e92df18d261bbaeac65b749945d716e7a8066a /scene
parenta695a6764eedc3f67fbc7796a78722d803d2c30f (diff)
parentf84ae146f026ae60d417eda97ec6fe7afb0052fe (diff)
Merge pull request #50363 from JestemStefan/node2D_zero_scale_det_error
Limit scale of `Node2D` to EPSILON (0.00001) to prevent `det==0` error
Diffstat (limited to 'scene')
-rw-r--r--scene/2d/node_2d.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp
index 6fd383ddab..a744ef40f6 100644
--- a/scene/2d/node_2d.cpp
+++ b/scene/2d/node_2d.cpp
@@ -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();