From 7352a4c0d964d7aa7c3180fd493079107a4c5217 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Thu, 29 Apr 2021 18:18:39 -0700 Subject: [PATCH] Expose get_debug_mesh in Shape3D to scripting API Can be useful for custom drawing of physics shapes without having to add a collision object node to the tree. --- doc/classes/Shape3D.xml | 7 +++++++ scene/resources/shape_3d.cpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/doc/classes/Shape3D.xml b/doc/classes/Shape3D.xml index f8b749aebfa..b5f70132d71 100644 --- a/doc/classes/Shape3D.xml +++ b/doc/classes/Shape3D.xml @@ -10,6 +10,13 @@ https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html + + + + + Returns the [ArrayMesh] used to draw the debug collision for this [Shape3D]. + + diff --git a/scene/resources/shape_3d.cpp b/scene/resources/shape_3d.cpp index 5761a405ce8..cb44e059a3f 100644 --- a/scene/resources/shape_3d.cpp +++ b/scene/resources/shape_3d.cpp @@ -102,6 +102,8 @@ void Shape3D::_bind_methods() { ClassDB::bind_method(D_METHOD("set_margin", "margin"), &Shape3D::set_margin); ClassDB::bind_method(D_METHOD("get_margin"), &Shape3D::get_margin); + ClassDB::bind_method(D_METHOD("get_debug_mesh"), &Shape3D::get_debug_mesh); + ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0.001,10,0.001"), "set_margin", "get_margin"); }