Skip to content

Commit

Permalink
Merge pull request #77065 from FranckRJ/fix-capsuleshape2d-getrect
Browse files Browse the repository at this point in the history
Fixed width of CapsuleShape2D::get_rect + set center to center of shape
  • Loading branch information
akien-mga committed May 15, 2023
2 parents e2f27a2 + ab5462e commit 37fd9a3
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion scene/resources/capsule_shape_2d.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down

0 comments on commit 37fd9a3

Please sign in to comment.