diff --git a/include/omath/linear_algebra/vector3.hpp b/include/omath/linear_algebra/vector3.hpp index 7228d81..7e5838f 100644 --- a/include/omath/linear_algebra/vector3.hpp +++ b/include/omath/linear_algebra/vector3.hpp @@ -245,15 +245,6 @@ namespace omath return std::make_tuple(this->x, this->y, z); } - [[nodiscard]] Vector3 view_angle_to(const Vector3& other) const noexcept - { - const auto distance = distance_to(other); - const auto delta = other - *this; - - return {angles::radians_to_degrees(std::asin(delta.z / distance)), - angles::radians_to_degrees(std::atan2(delta.y, delta.x)), 0}; - } - [[nodiscard]] bool operator<(const Vector3& other) const noexcept { diff --git a/tests/general/unit_test_prediction.cpp b/tests/general/unit_test_prediction.cpp index 6fb054a..a0c22d5 100644 --- a/tests/general/unit_test_prediction.cpp +++ b/tests/general/unit_test_prediction.cpp @@ -1,6 +1,6 @@ #include #include - +#include TEST(UnitTestPrediction, PredictionTest) { constexpr omath::projectile_prediction::Target target{ @@ -10,8 +10,9 @@ TEST(UnitTestPrediction, PredictionTest) const auto viewPoint = omath::projectile_prediction::ProjPredEngineLegacy(400, 1.f / 1000.f, 50, 5.f).maybe_calculate_aim_point(proj, target); - const auto [pitch, yaw, _] = proj.m_origin.view_angle_to(viewPoint.value()).as_tuple(); - EXPECT_NEAR(42.547142, pitch, 0.01f); - EXPECT_NEAR(-1.181189, yaw, 0.01f); + const auto [pitch, yaw, _] =omath::source_engine::CameraTrait::calc_look_at_angle(proj.m_origin, viewPoint.value()); + + EXPECT_NEAR(-42.547142, pitch.as_degrees(), 0.01f); + EXPECT_NEAR(-1.181189, yaw.as_degrees(), 0.01f); }