From dd97ff44ab7213705a89d9489cb90bbf91eb18e6 Mon Sep 17 00:00:00 2001 From: Birk Magnussen <6238428+BMagnu@users.noreply.github.com> Date: Fri, 12 Apr 2024 18:38:35 +0200 Subject: [PATCH] Fixes the issue where setting global rotation would reset scale. This was caused because the basis for the target global transform was entirely recreated. This process did not account for the scale of the basis of the current global transform. This PR amends this by scaling the recreated basis for the global transform by the current global scale of the Node3D. Note that this scaling has to be done from the current global scale and not from the local scale of the Node3D, otherwise issues would arise if parents of this Node3D would be scaled. --- scene/3d/node_3d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/scene/3d/node_3d.cpp b/scene/3d/node_3d.cpp index 5c081a0b47d1..b11a1d950691 100644 --- a/scene/3d/node_3d.cpp +++ b/scene/3d/node_3d.cpp @@ -293,7 +293,7 @@ Vector3 Node3D::get_global_rotation_degrees() const { void Node3D::set_global_rotation(const Vector3 &p_euler_rad) { ERR_THREAD_GUARD; Transform3D transform = get_global_transform(); - transform.basis = Basis::from_euler(p_euler_rad); + transform.basis = Basis::from_euler(p_euler_rad) * Basis::from_scale(transform.basis.get_scale()); set_global_transform(transform); }