From a53841021ca4ddb8452521ea6bab51ebb79a82a4 Mon Sep 17 00:00:00 2001 From: Miguel Coelho Date: Fri, 5 Apr 2024 10:20:17 +0100 Subject: [PATCH] Fixes 3D axes flickering in the negative direction When zooming out in the 3d node editor view, the negative half of all 3d axes starts flickering upon moving the camera. To fix this, the logic surrounding 3d transform "scaled" and "translated" calls has been altered so as to account for negative distance values. Fixes #89215. --- editor/plugins/node_3d_editor_plugin.cpp | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/editor/plugins/node_3d_editor_plugin.cpp b/editor/plugins/node_3d_editor_plugin.cpp index d09e4fd3db0d..88250ea3c37a 100644 --- a/editor/plugins/node_3d_editor_plugin.cpp +++ b/editor/plugins/node_3d_editor_plugin.cpp @@ -6639,8 +6639,13 @@ void fragment() { for (int j = 0; j < 4; j++) { Transform3D t = Transform3D(); - t = t.scaled(axis * distances[j + 1]); - t = t.translated(axis * distances[j]); + if (distances[j] > 0.0) { + t = t.scaled(axis * distances[j + 1]); + t = t.translated(axis * distances[j]); + } else { + t = t.scaled(axis * distances[j]); + t = t.translated(axis * distances[j + 1]); + } RenderingServer::get_singleton()->multimesh_instance_set_transform(origin_multimesh, i * 4 + j, t); RenderingServer::get_singleton()->multimesh_instance_set_color(origin_multimesh, i * 4 + j, origin_color); }