From a1f616dcfc9b4efa08a5e69e1b979ea7911dc1f8 Mon Sep 17 00:00:00 2001 From: Anilforextra Date: Mon, 6 Sep 2021 12:17:50 +0545 Subject: Use builtin Vector2 functions for calculation of angles. . --- core/math/transform_2d.cpp | 2 +- core/math/vector2.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) (limited to 'core') diff --git a/core/math/transform_2d.cpp b/core/math/transform_2d.cpp index 16934d67df..e4f1626646 100644 --- a/core/math/transform_2d.cpp +++ b/core/math/transform_2d.cpp @@ -271,7 +271,7 @@ Transform2D Transform2D::interpolate_with(const Transform2D &p_transform, real_t } //construct matrix - Transform2D res(Math::atan2(v.y, v.x), p1.lerp(p2, p_c)); + Transform2D res(v.angle(), p1.lerp(p2, p_c)); res.scale_basis(s1.lerp(s2, p_c)); return res; } diff --git a/core/math/vector2.cpp b/core/math/vector2.cpp index b53dc05a00..16e43d7d06 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 Math::atan2(y - p_vector2.y, x - p_vector2.x); + return (*this - p_vector2).angle(); } real_t Vector2::dot(const Vector2 &p_other) const { -- cgit v1.2.3