Skip to content

Commit

Permalink
Expose get_debug_mesh in Shape to scripting API
Browse files Browse the repository at this point in the history
Can be useful for custom drawing of physics shapes without having to add
a collision object node to the tree.
  • Loading branch information
pouleyKetchoupp committed Apr 30, 2021
1 parent 595a74c commit 0ba5001
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions doc/classes/Shape.xml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,13 @@
<link>https://docs.godotengine.org/en/3.3/tutorials/physics/physics_introduction.html</link>
</tutorials>
<methods>
<method name="get_debug_mesh">
<return type="ArrayMesh">
</return>
<description>
Returns the [ArrayMesh] used to draw the debug collision for this [Shape].
</description>
</method>
</methods>
<members>
<member name="margin" type="float" setter="set_margin" getter="get_margin" default="0.04">
Expand Down
2 changes: 2 additions & 0 deletions scene/resources/shape.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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");
}

Expand Down

0 comments on commit 0ba5001

Please sign in to comment.