diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp index 6259bdead02..1d3f93848e8 100644 --- a/core/math/vector2.cpp +++ b/core/math/vector2.cpp @@ -79,7 +79,7 @@ real_t Vector2::angle_to(const Vector2 &p_vector2) const { } real_t Vector2::angle_to_point(const Vector2 &p_vector2) const { - return (*this - p_vector2).angle(); + return (p_vector2 - *this).angle(); } real_t Vector2::dot(const Vector2 &p_other) const { diff --git a/doc/classes/Vector2.xml b/doc/classes/Vector2.xml index eaaf41561ac..02770472fa6 100644 --- a/doc/classes/Vector2.xml +++ b/doc/classes/Vector2.xml @@ -75,6 +75,7 @@ Returns the angle between the line connecting the two points and the X axis, in radians. + [code]a.angle_to_point(b)[/code] is equivalent of doing [code](b - a).angle()[/code]. [url=https://raw.githubusercontent.com/godotengine/godot-docs/master/img/vector2_angle_to_point.png]Illustration of the returned angle.[/url]