summaryrefslogtreecommitdiff
path: root/scene/resources/concave_polygon_shape.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/resources/concave_polygon_shape.cpp')
-rw-r--r--scene/resources/concave_polygon_shape.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/resources/concave_polygon_shape.cpp b/scene/resources/concave_polygon_shape.cpp
index 48cc08eae4..0a93f99ea3 100644
--- a/scene/resources/concave_polygon_shape.cpp
+++ b/scene/resources/concave_polygon_shape.cpp
@@ -64,6 +64,16 @@ Vector<Vector3> ConcavePolygonShape::get_debug_mesh_lines() {
return points;
}
+real_t ConcavePolygonShape::get_enclosing_radius() const {
+ PoolVector<Vector3> data = get_faces();
+ PoolVector<Vector3>::Read read = data.read();
+ real_t r = 0;
+ for (int i(0); i < data.size(); i++) {
+ r = MAX(read[i].length_squared(), r);
+ }
+ return Math::sqrt(r);
+}
+
void ConcavePolygonShape::_update_shape() {
Shape::_update_shape();
}