summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2019-05-29 17:18:17 +0200
committerGitHub <noreply@github.com>2019-05-29 17:18:17 +0200
commite9ca1a129964e03a42c0318ef449e9e9d34a4d47 (patch)
treec0c6ec32486e3154c3378b126d9c1e0c6d5cec5e
parent62c9af4072860168a475ab95a0e1f5bcca348017 (diff)
parent5b378f408c5a0e8e0c2b4c1cbff67959fd097ce9 (diff)
Merge pull request #25520 from Zylann/expose_node_custom_aabb
Exposed custom AABB setter on GeometryInstance
-rw-r--r--doc/classes/GeometryInstance.xml9
-rw-r--r--scene/3d/visual_instance.cpp7
-rw-r--r--scene/3d/visual_instance.h2
3 files changed, 18 insertions, 0 deletions
diff --git a/doc/classes/GeometryInstance.xml b/doc/classes/GeometryInstance.xml
index 6a89d81aa0..674f786149 100644
--- a/doc/classes/GeometryInstance.xml
+++ b/doc/classes/GeometryInstance.xml
@@ -9,6 +9,15 @@
<tutorials>
</tutorials>
<methods>
+ <method name="set_custom_aabb">
+ <return type="void">
+ </return>
+ <argument index="0" name="aabb" type="AABB">
+ </argument>
+ <description>
+ Overrides the bounding box of this node with a custom one. To remove it, set an AABB with all fields set to zero.
+ </description>
+ </method>
</methods>
<members>
<member name="cast_shadow" type="int" setter="set_cast_shadows_setting" getter="get_cast_shadows_setting" enum="GeometryInstance.ShadowCastingSetting">
diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp
index 1aded826c0..99c86f0406 100644
--- a/scene/3d/visual_instance.cpp
+++ b/scene/3d/visual_instance.cpp
@@ -271,6 +271,11 @@ float GeometryInstance::get_extra_cull_margin() const {
return extra_cull_margin;
}
+void GeometryInstance::set_custom_aabb(AABB aabb) {
+
+ VS::get_singleton()->instance_set_custom_aabb(get_instance(), aabb);
+}
+
void GeometryInstance::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_material_override", "material"), &GeometryInstance::set_material_override);
@@ -297,6 +302,8 @@ void GeometryInstance::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_extra_cull_margin", "margin"), &GeometryInstance::set_extra_cull_margin);
ClassDB::bind_method(D_METHOD("get_extra_cull_margin"), &GeometryInstance::get_extra_cull_margin);
+ ClassDB::bind_method(D_METHOD("set_custom_aabb", "aabb"), &GeometryInstance::set_custom_aabb);
+
ClassDB::bind_method(D_METHOD("get_aabb"), &GeometryInstance::get_aabb);
ADD_GROUP("Geometry", "");
diff --git a/scene/3d/visual_instance.h b/scene/3d/visual_instance.h
index f5b7479bb1..0e7d9be505 100644
--- a/scene/3d/visual_instance.h
+++ b/scene/3d/visual_instance.h
@@ -139,6 +139,8 @@ public:
void set_extra_cull_margin(float p_margin);
float get_extra_cull_margin() const;
+ void set_custom_aabb(AABB aabb);
+
GeometryInstance();
};