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.
This commit is contained in:
lawnjelly 2022-04-28 12:15:14 +01:00 committed by Relintai
parent b26a1cd3b4
commit 3a191189ca

View File

@ -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: {