summaryrefslogtreecommitdiffstats
path: root/scene/3d/multimesh_instance_3d.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'scene/3d/multimesh_instance_3d.cpp')
-rw-r--r--scene/3d/multimesh_instance_3d.cpp19
1 files changed, 19 insertions, 0 deletions
diff --git a/scene/3d/multimesh_instance_3d.cpp b/scene/3d/multimesh_instance_3d.cpp
index 55d6e49e6c..2eef1dbbf4 100644
--- a/scene/3d/multimesh_instance_3d.cpp
+++ b/scene/3d/multimesh_instance_3d.cpp
@@ -30,16 +30,35 @@
#include "multimesh_instance_3d.h"
+void MultiMeshInstance3D::_refresh_interpolated() {
+ if (is_inside_tree() && multimesh.is_valid()) {
+ bool interpolated = is_physics_interpolated_and_enabled();
+ multimesh->set_physics_interpolated(interpolated);
+ }
+}
+
+void MultiMeshInstance3D::_physics_interpolated_changed() {
+ VisualInstance3D::_physics_interpolated_changed();
+ _refresh_interpolated();
+}
+
void MultiMeshInstance3D::_bind_methods() {
ClassDB::bind_method(D_METHOD("set_multimesh", "multimesh"), &MultiMeshInstance3D::set_multimesh);
ClassDB::bind_method(D_METHOD("get_multimesh"), &MultiMeshInstance3D::get_multimesh);
ADD_PROPERTY(PropertyInfo(Variant::OBJECT, "multimesh", PROPERTY_HINT_RESOURCE_TYPE, "MultiMesh"), "set_multimesh", "get_multimesh");
}
+void MultiMeshInstance3D::_notification(int p_what) {
+ if (p_what == NOTIFICATION_ENTER_TREE) {
+ _refresh_interpolated();
+ }
+}
+
void MultiMeshInstance3D::set_multimesh(const Ref<MultiMesh> &p_multimesh) {
multimesh = p_multimesh;
if (multimesh.is_valid()) {
set_base(multimesh->get_rid());
+ _refresh_interpolated();
} else {
set_base(RID());
}