Assign zero to range when ConvexPolygonShape2D is empty.

This commit is contained in:
Marcel Admiraal 2020-04-14 12:40:24 +01:00
parent e0eb9a8ae4
commit 88d307df14
1 changed files with 5 additions and 1 deletions

View File

@ -465,7 +465,11 @@ public:
virtual Variant get_data() const;
_FORCE_INLINE_ void project_range(const Vector2 &p_normal, const Transform2D &p_transform, real_t &r_min, real_t &r_max) const {
// no matter the angle, the box is mirrored anyway
if (!points || point_count <= 0) {
r_min = r_max = 0;
return;
}
r_min = r_max = p_normal.dot(p_transform.xform(points[0].pos));
for (int i = 1; i < point_count; i++) {