From 49eaa7bd659fd8502eadd534d248275e6890e084 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 539cd5ddb48..d6d8be962cf 100644 --- a/scene/3d/visual_instance.cpp +++ b/scene/3d/visual_instance.cpp @@ -97,7 +97,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); @@ -105,10 +105,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: {