diff options
author | Andrea Catania <info@andreacatania.com> | 2020-01-10 12:22:34 +0100 |
---|---|---|
committer | Andrea Catania <info@andreacatania.com> | 2020-02-10 14:38:52 +0100 |
commit | e6be3f68da4b88cb0c7d8c7464916235c73e1f92 (patch) | |
tree | 2e65162fd1937df8b4dcd80900dd5b9b4aac58d1 /scene/resources/convex_polygon_shape.cpp | |
parent | 8cd5102c65269f1ec4968627ca71df550954d914 (diff) | |
download | redot-engine-e6be3f68da4b88cb0c7d8c7464916235c73e1f92.tar.gz |
- Integrated NavigationServer and Navigation2DServer.
- Added Navigation Agents and Obstacles.
- Integrated Collision Avoidance.
This work has been kindly sponsored by IMVU.
Diffstat (limited to 'scene/resources/convex_polygon_shape.cpp')
-rw-r--r-- | scene/resources/convex_polygon_shape.cpp | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/scene/resources/convex_polygon_shape.cpp b/scene/resources/convex_polygon_shape.cpp index 1498eb4af9..21fdcc1f06 100644 --- a/scene/resources/convex_polygon_shape.cpp +++ b/scene/resources/convex_polygon_shape.cpp @@ -55,6 +55,16 @@ Vector<Vector3> ConvexPolygonShape::get_debug_mesh_lines() { return Vector<Vector3>(); } +real_t ConvexPolygonShape::get_enclosing_radius() const { + PoolVector<Vector3> data = get_points(); + 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 ConvexPolygonShape::_update_shape() { PhysicsServer::get_singleton()->shape_set_data(get_shape(), points); |