ソースを参照

Merge pull request #50351 from JestemStefan/node_2D_zero_scale_det_bug

[3.x] Limit scale of `Node2D` to EPSILON (0.00001) to prevent det==0 error
Rémi Verschelde 4 年 前
コミット
1cd10461ca
1 ファイル変更2 行追加2 行削除
  1. 2 2
      scene/2d/node_2d.cpp

+ 2 - 2
scene/2d/node_2d.cpp

@@ -174,10 +174,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();