From f19133096810f8c1639a6001b38ccc24f1b92bad Mon Sep 17 00:00:00 2001 From: rsburke4 Date: Wed, 8 Nov 2023 20:40:08 -0500 Subject: [PATCH] Node3D children using top_level in different position in-editor vs. runtime --- scene/3d/node_3d.cpp | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp index cb8279d534b..786310c6485 100644 --- a/scene/3d/node_3d.cpp +++ b/scene/3d/node_3d.cpp @@ -149,7 +149,11 @@ void Node3D::_notification(int p_what) { if (data.top_level && !Engine::get_singleton()->is_editor_hint()) { if (data.parent) { - data.local_transform = data.parent->get_global_transform() * get_transform(); + if (!data.top_level) { + data.local_transform = data.parent->get_global_transform() * get_transform(); + } else { + data.local_transform = get_transform(); + } _replace_dirty_mask(DIRTY_EULER_ROTATION_AND_SCALE); // As local transform was updated, rot/scale should be dirty. } } @@ -738,7 +742,7 @@ void Node3D::set_as_top_level(bool p_enabled) { if (data.top_level == p_enabled) { return; } - if (is_inside_tree() && !Engine::get_singleton()->is_editor_hint()) { + if (is_inside_tree()) { if (p_enabled) { set_transform(get_global_transform()); } else if (data.parent) {