diff options
-rw-r--r-- | scene/3d/remote_transform.cpp | 36 |
1 files changed, 19 insertions, 17 deletions
diff --git a/scene/3d/remote_transform.cpp b/scene/3d/remote_transform.cpp index c12e49fb47..490fcf24fd 100644 --- a/scene/3d/remote_transform.cpp +++ b/scene/3d/remote_transform.cpp @@ -63,38 +63,40 @@ void RemoteTransform::_update_remote() { if (update_remote_position && update_remote_rotation && update_remote_scale) { n->set_global_transform(get_global_transform()); } else { - Transform n_trans = n->get_global_transform(); Transform our_trans = get_global_transform(); - if (!update_remote_position) - our_trans.set_origin(n_trans.get_origin()); + if (update_remote_rotation) + n->set_rotation(our_trans.basis.get_rotation()); - n->set_global_transform(our_trans); + if (update_remote_scale) + n->set_scale(our_trans.basis.get_scale()); - if (!update_remote_rotation) - n->set_rotation(n_trans.basis.get_rotation()); + if (update_remote_position) { + Transform n_trans = n->get_global_transform(); - if (!update_remote_scale) - n->set_scale(n_trans.basis.get_scale()); + n_trans.set_origin(our_trans.get_origin()); + n->set_global_transform(n_trans); + } } } else { if (update_remote_position && update_remote_rotation && update_remote_scale) { - n->set_global_transform(get_global_transform()); + n->set_transform(get_transform()); } else { - Transform n_trans = n->get_transform(); Transform our_trans = get_transform(); - if (!update_remote_position) - our_trans.set_origin(n_trans.get_origin()); + if (update_remote_rotation) + n->set_rotation(our_trans.basis.get_rotation()); - n->set_transform(our_trans); + if (update_remote_scale) + n->set_scale(our_trans.basis.get_scale()); - if (!update_remote_rotation) - n->set_rotation(n_trans.basis.get_rotation()); + if (update_remote_position) { + Transform n_trans = n->get_transform(); - if (!update_remote_scale) - n->set_scale(n_trans.basis.get_scale()); + n_trans.set_origin(our_trans.get_origin()); + n->set_transform(n_trans); + } } } } |