From 5b378f408c5a0e8e0c2b4c1cbff67959fd097ce9 Mon Sep 17 00:00:00 2001 From: Marc Gilleron Date: Thu, 31 Jan 2019 17:54:00 +0100 Subject: [PATCH] Exposed custom AABB setter on GeometryInstance --- doc/classes/GeometryInstance.xml | 9 +++++++++ scene/3d/visual_instance.cpp | 7 +++++++ scene/3d/visual_instance.h | 2 ++ 3 files changed, 18 insertions(+) diff --git a/doc/classes/GeometryInstance.xml b/doc/classes/GeometryInstance.xml index d6267044f75..f2f97d02642 100644 --- a/doc/classes/GeometryInstance.xml +++ b/doc/classes/GeometryInstance.xml @@ -11,6 +11,15 @@ + + + + + + + Overrides the bounding box of this node with a custom one. To remove it, set an AABB with all fields set to zero. + + diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index 1bbf1b7bc79..0af6df72b69 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -263,6 +263,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); @@ -289,6 +294,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 3b6fccf65f0..9192f059a93 100644 --- a/scene/3d/visual_instance.h +++ b/scene/3d/visual_instance.h @@ -137,6 +137,8 @@ public: void set_extra_cull_margin(float p_margin); float get_extra_cull_margin() const; + void set_custom_aabb(AABB aabb); + GeometryInstance(); };