Browse Source

Merge pull request #48315 from nekomatata/expose-physics-debug-shape

Expose get_debug_mesh in Shape3D to scripting API
Rémi Verschelde 4 years ago
parent
commit
e144ff0445
2 changed files with 9 additions and 0 deletions
  1. 7 0
      doc/classes/Shape3D.xml
  2. 2 0
      scene/resources/shape_3d.cpp

+ 7 - 0
doc/classes/Shape3D.xml

@@ -10,6 +10,13 @@
 		<link title="Physics introduction">https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link>
 		<link title="Physics introduction">https://docs.godotengine.org/en/latest/tutorials/physics/physics_introduction.html</link>
 	</tutorials>
 	</tutorials>
 	<methods>
 	<methods>
+		<method name="get_debug_mesh">
+			<return type="ArrayMesh">
+			</return>
+			<description>
+				Returns the [ArrayMesh] used to draw the debug collision for this [Shape3D].
+			</description>
+		</method>
 	</methods>
 	</methods>
 	<members>
 	<members>
 		<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.04">
 		<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.04">

+ 2 - 0
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("set_margin", "margin"), &Shape3D::set_margin);
 	ClassDB::bind_method(D_METHOD("get_margin"), &Shape3D::get_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");
 	ADD_PROPERTY(PropertyInfo(Variant::FLOAT, "margin", PROPERTY_HINT_RANGE, "0.001,10,0.001"), "set_margin", "get_margin");
 }
 }