From 163cdb89547fcc110a8693216be09668eea97223 Mon Sep 17 00:00:00 2001 From: Paul Trojahn Date: Wed, 30 Jan 2019 19:14:43 +0100 Subject: 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 --- scene/2d/node_2d.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'scene') 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 { -- cgit v1.2.3