浏览代码

Use atan2 rather than acos in Vector3.angle_to.

Fixes #8111.

(cherry picked from commit 3730e0533cceaefe7981387804556810442865e1)
Ferenc Arn 8 年之前
父节点
当前提交
f263274a25
共有 1 个文件被更改,包括 1 次插入1 次删除
  1. 1 1
      core/math/vector3.h

+ 1 - 1
core/math/vector3.h

@@ -193,7 +193,7 @@ real_t Vector3::distance_squared_to(const Vector3 &p_b) const {
 
 
 real_t Vector3::angle_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 */
 /* Operators */