From 3730e0533cceaefe7981387804556810442865e1 Mon Sep 17 00:00:00 2001 From: Ferenc Arn Date: Fri, 24 Mar 2017 12:03:33 -0500 Subject: [PATCH] Use atan2 rather than acos in Vector3.angle_to. Fixes #8111. --- core/math/vector3.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/math/vector3.h b/core/math/vector3.h index fc02e66c331..9a31ec4f277 100644 --- a/core/math/vector3.h +++ b/core/math/vector3.h @@ -214,7 +214,7 @@ real_t Vector3::distance_squared_to(const Vector3 &p_b) const { real_t Vector3::angle_to(const Vector3 &p_b) const { - return Math::acos(this->dot(p_b) / Math::sqrt(this->length_squared() * p_b.length_squared())); + return Math::atan2(cross(p_b).length(), dot(p_b)); } /* Operators */