Node3D children using top_level in different position in-editor vs. runtime

This commit is contained in:
rsburke4 2023-11-08 20:40:08 -05:00
parent e5bacbc471
commit f191330968

View File

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