Merge pull request #84643 from rsburke4/top-level-problem-fix
Fix `Node3D` children using `top_level` in different position in-editor versus runtime
This commit is contained in:
commit
7de27ea56a
1 changed files with 6 additions and 2 deletions
|
@ -148,7 +148,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.
|
||||
}
|
||||
}
|
||||
|
@ -737,7 +741,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) {
|
||||
|
|
Loading…
Reference in a new issue