diff options
| author | Juan Linietsky | 2015-12-14 09:06:53 -0300 |
|---|---|---|
| committer | Juan Linietsky | 2015-12-14 09:06:53 -0300 |
| commit | 1312df7fdcf9fceff63cf82bf97d6101c2c52215 (patch) | |
| tree | a782230a3052dddcd709dd9dca25f7ab79ed8c3d /scene/resources/convex_polygon_shape_2d.cpp | |
| parent | f2183a5e09cc55a91b550f0d8f45b45a93d82b29 (diff) | |
| download | godot-1312df7fdcf9fceff63cf82bf97d6101c2c52215.tar.gz godot-1312df7fdcf9fceff63cf82bf97d6101c2c52215.tar.zst godot-1312df7fdcf9fceff63cf82bf97d6101c2c52215.zip | |
Diffstat (limited to 'scene/resources/convex_polygon_shape_2d.cpp')
| -rw-r--r-- | scene/resources/convex_polygon_shape_2d.cpp | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/scene/resources/convex_polygon_shape_2d.cpp b/scene/resources/convex_polygon_shape_2d.cpp index a1137ba61..86cf818ac 100644 --- a/scene/resources/convex_polygon_shape_2d.cpp +++ b/scene/resources/convex_polygon_shape_2d.cpp @@ -30,6 +30,8 @@ #include "servers/physics_2d_server.h" #include "servers/visual_server.h" +#include "geometry.h" + void ConvexPolygonShape2D::_update_shape() { Physics2DServer::get_singleton()->shape_set_data(get_rid(),points); @@ -40,7 +42,9 @@ void ConvexPolygonShape2D::_update_shape() { void ConvexPolygonShape2D::set_point_cloud(const Vector<Vector2>& p_points) { - + Vector<Point2> hull=Geometry::convex_hull_2d(p_points); + ERR_FAIL_COND(hull.size()<3); + set_points(hull); } void ConvexPolygonShape2D::set_points(const Vector<Vector2>& p_points) { |
