diff options
author | Paul Trojahn <paul.trojahn@gmail.com> | 2019-01-30 19:14:43 +0100 |
---|---|---|
committer | Paul Trojahn <paul.trojahn@gmail.com> | 2019-02-08 18:00:54 +0100 |
commit | 163cdb89547fcc110a8693216be09668eea97223 (patch) | |
tree | e4aff621393e57804d62902f833568ef402622e8 /scene/2d | |
parent | 953cd03ea6ee9fd6d0d3fde9658777cc4020d0a7 (diff) |
Fix look_at with non uniform scaling
The angle function doesn't consider the scaling of the local coordinates,
so it needs to be removed first. Fixes #23247
Diffstat (limited to 'scene/2d')
-rw-r--r-- | scene/2d/node_2d.cpp | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/scene/2d/node_2d.cpp b/scene/2d/node_2d.cpp index 9a94092840..f4430d93f6 100644 --- a/scene/2d/node_2d.cpp +++ b/scene/2d/node_2d.cpp @@ -376,7 +376,7 @@ void Node2D::look_at(const Vector2 &p_pos) { float Node2D::get_angle_to(const Vector2 &p_pos) const { - return (get_global_transform().affine_inverse().xform(p_pos)).angle(); + return (to_local(p_pos) * get_scale()).angle(); } Point2 Node2D::to_local(Point2 p_global) const { |