summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2020-05-10 13:06:05 +0200
committerGitHub <noreply@github.com>2020-05-10 13:06:05 +0200
commit2d8d311b1280c78e1ae70900186d5ae22a488828 (patch)
tree45f84d2ea64ef514445c05794ec2d4edfcc044ad
parentc304b66a68f539850723126db7cd0286aba99fa7 (diff)
parent68eaaa6d6b7757d0d1c4f6c6403c0c0c6b5d702b (diff)
Merge pull request #38617 from madmiraal/fix-38514
Prevent CapsuleShape2D height from being less than zero.
-rw-r--r--scene/resources/capsule_shape_2d.cpp3
1 files changed, 3 insertions, 0 deletions
diff --git a/scene/resources/capsule_shape_2d.cpp b/scene/resources/capsule_shape_2d.cpp
index ab2657c892..5a3282478c 100644
--- a/scene/resources/capsule_shape_2d.cpp
+++ b/scene/resources/capsule_shape_2d.cpp
@@ -72,6 +72,9 @@ real_t CapsuleShape2D::get_radius() const {
void CapsuleShape2D::set_height(real_t p_height) {
height = p_height;
+ if (height < 0)
+ height = 0;
+
_update_shape();
}