summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRĂ©mi Verschelde <rverschelde@gmail.com>2019-12-13 09:14:16 +0100
committerGitHub <noreply@github.com>2019-12-13 09:14:16 +0100
commit1cd736951a4ad0f0d66917252a86eb6ac8001673 (patch)
treec5be7baa2695f3ccd34a28e9f8442c45982a241a
parentadb703bc59a2281fcc4c9ca1e89408622b419889 (diff)
parenta139104646d8358b881c33f5c79db4e414a1ab82 (diff)
Merge pull request #34189 from aaronfranke/mesh-aabb
Expose Mesh get_aabb
-rw-r--r--doc/classes/Mesh.xml8
-rw-r--r--scene/resources/mesh.cpp1
2 files changed, 9 insertions, 0 deletions
diff --git a/doc/classes/Mesh.xml b/doc/classes/Mesh.xml
index f7b3b0d7ea..d4804930e1 100644
--- a/doc/classes/Mesh.xml
+++ b/doc/classes/Mesh.xml
@@ -40,6 +40,14 @@
Generate a [TriangleMesh] from the mesh.
</description>
</method>
+ <method name="get_aabb" qualifiers="const">
+ <return type="AABB">
+ </return>
+ <description>
+ Returns the smallest [AABB] enclosing this mesh. Not affected by [code]custom_aabb[/code].
+ [b]Note:[/b] This is only implemented for [ArrayMesh] and [PrimitiveMesh].
+ </description>
+ </method>
<method name="get_faces" qualifiers="const">
<return type="PoolVector3Array">
</return>
diff --git a/scene/resources/mesh.cpp b/scene/resources/mesh.cpp
index 4afb07cb6f..0d94d4dbf4 100644
--- a/scene/resources/mesh.cpp
+++ b/scene/resources/mesh.cpp
@@ -483,6 +483,7 @@ void Mesh::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_lightmap_size_hint", "size"), &Mesh::set_lightmap_size_hint);
ClassDB::bind_method(D_METHOD("get_lightmap_size_hint"), &Mesh::get_lightmap_size_hint);
+ ClassDB::bind_method(D_METHOD("get_aabb"), &Mesh::get_aabb);
ADD_PROPERTY(PropertyInfo(Variant::VECTOR2, "lightmap_size_hint"), "set_lightmap_size_hint", "get_lightmap_size_hint");