From 6f53257e05d72088c28028eb568526f4da146ae0 Mon Sep 17 00:00:00 2001 From: Relintai Date: Mon, 30 Sep 2024 16:41:05 +0200 Subject: [PATCH] Transform now uses Basis::create_looking_at. --- core/math/transform.cpp | 30 +----------------------------- 1 file changed, 1 insertion(+), 29 deletions(-) diff --git a/core/math/transform.cpp b/core/math/transform.cpp index 2820101e5..ec9d69431 100644 --- a/core/math/transform.cpp +++ b/core/math/transform.cpp @@ -83,35 +83,7 @@ void Transform::rotate_basis(const Vector3 &p_axis, real_t p_phi) { } void Transform::set_look_at(const Vector3 &p_eye, const Vector3 &p_target, const Vector3 &p_up) { -#ifdef MATH_CHECKS - ERR_FAIL_COND(p_eye == p_target); - ERR_FAIL_COND(p_up.length() == 0); -#endif - // Reference: MESA source code - Vector3 v_x, v_y, v_z; - - /* Make rotation matrix */ - - /* Z vector */ - v_z = p_eye - p_target; - - v_z.normalize(); - - v_y = p_up; - - v_x = v_y.cross(v_z); -#ifdef MATH_CHECKS - ERR_FAIL_COND(v_x.length() == 0); -#endif - - /* Recompute Y = Z cross X */ - v_y = v_z.cross(v_x); - - v_x.normalize(); - v_y.normalize(); - - basis.set(v_x, v_y, v_z); - + basis = Basis::create_looking_at(p_target - p_eye, p_up); origin = p_eye; }