瀏覽代碼

Prevent CapsuleShape2D height from being less than zero.

Marcel Admiraal 5 年之前
父節點
當前提交
68eaaa6d6b
共有 1 個文件被更改,包括 3 次插入0 次删除
  1. 3 0
      scene/resources/capsule_shape_2d.cpp

+ 3 - 0
scene/resources/capsule_shape_2d.cpp

@@ -72,6 +72,9 @@ real_t CapsuleShape2D::get_radius() const {
 void CapsuleShape2D::set_height(real_t p_height) {
 void CapsuleShape2D::set_height(real_t p_height) {
 
 
 	height = p_height;
 	height = p_height;
+	if (height < 0)
+		height = 0;
+
 	_update_shape();
 	_update_shape();
 }
 }