Преглед на файлове

Merge pull request #77065 from FranckRJ/fix-capsuleshape2d-getrect

Fixed width of CapsuleShape2D::get_rect + set center to center of shape
Rémi Verschelde преди 2 години
родител
ревизия
37fd9a32f3
променени са 1 файла, в които са добавени 2 реда и са изтрити 1 реда
  1. 2 1
      scene/resources/capsule_shape_2d.cpp

+ 2 - 1
scene/resources/capsule_shape_2d.cpp

@@ -97,7 +97,8 @@ void CapsuleShape2D::draw(const RID &p_to_rid, const Color &p_color) {
 }
 
 Rect2 CapsuleShape2D::get_rect() const {
-	return Rect2(0, 0, radius, height);
+	const Vector2 half_size = Vector2(radius, height * 0.5);
+	return Rect2(-half_size, half_size * 2.0);
 }
 
 real_t CapsuleShape2D::get_enclosing_radius() const {