From 3a191189cacd4fb7f3d31f7532b8b60560a97b6f Mon Sep 17 00:00:00 2001 From: lawnjelly Date: Thu, 28 Apr 2022 12:15:14 +0100 Subject: [PATCH] Physics interpolation - fix streaking when unhiding nodes The data flow to the VisualServer of current and previous transforms is essential for allowing correct interpolation. An optimization was present that disabled sending transforms when nodes were hidden, however this meant that when unhidden, nodes would interpolate incorrectly from the last transform received when hiding, rather than the up to date previous transform. This PR disables the optimization and sends always sends transforms when a node is interpolated. --- scene/3d/visual_instance.cpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/scene/3d/visual_instance.cpp b/scene/3d/visual_instance.cpp index d31699881..d9baa5be3 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -99,7 +99,7 @@ void VisualInstance::_notification(int p_what) { } break; case NOTIFICATION_TRANSFORM_CHANGED: { - if (_is_vi_visible()) { + if (_is_vi_visible() || is_physics_interpolated_and_enabled()) { if (!_is_using_identity_transform()) { Transform gt = get_global_transform(); VisualServer::get_singleton()->instance_set_transform(instance, gt); @@ -107,10 +107,8 @@ void VisualInstance::_notification(int p_what) { } } break; case NOTIFICATION_RESET_PHYSICS_INTERPOLATION: { - if (_is_vi_visible()) { - if (is_physics_interpolated()) { - VisualServer::get_singleton()->instance_reset_physics_interpolation(instance); - } + if (_is_vi_visible() && is_physics_interpolated()) { + VisualServer::get_singleton()->instance_reset_physics_interpolation(instance); } } break; case NOTIFICATION_EXIT_WORLD: {