From 0ba5001fb62bc0330b9e29c70694ef13e01f22a3 Mon Sep 17 00:00:00 2001 From: PouleyKetchoupp Date: Thu, 29 Apr 2021 18:20:29 -0700 Subject: [PATCH] Expose get_debug_mesh in Shape 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/Shape.xml | 7 +++++++ scene/resources/shape.cpp | 2 ++ 2 files changed, 9 insertions(+) diff --git a/doc/classes/Shape.xml b/doc/classes/Shape.xml index a728df1eb82..66ce155d52f 100644 --- a/doc/classes/Shape.xml +++ b/doc/classes/Shape.xml @@ -10,6 +10,13 @@ https://docs.godotengine.org/en/3.3/tutorials/physics/physics_introduction.html + + + + + Returns the [ArrayMesh] used to draw the debug collision for this [Shape]. + + diff --git a/scene/resources/shape.cpp b/scene/resources/shape.cpp index 3361016de5b..84924375768 100644 --- a/scene/resources/shape.cpp +++ b/scene/resources/shape.cpp @@ -106,6 +106,8 @@ void Shape::_bind_methods() { ClassDB::bind_method(D_METHOD("set_margin", "margin"), &Shape::set_margin); ClassDB::bind_method(D_METHOD("get_margin"), &Shape::get_margin); + ClassDB::bind_method(D_METHOD("get_debug_mesh"), &Shape::get_debug_mesh); + ADD_PROPERTY(PropertyInfo(Variant::REAL, "margin", PROPERTY_HINT_RANGE, "0.001,10,0.001"), "set_margin", "get_margin"); }