1
0
mirror of https://github.com/godotengine/godot.git synced 2025-11-04 12:00:25 +00:00

Limit scale of node2D to EPSILON 0.00001 to prevent det==0 bug

This commit is contained in:
JestemStefan
2021-07-11 07:53:14 +02:00
committed by JestemStefan
parent 374ffbe2d2
commit f84ae146f0

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();