diff --git a/source/engines/unity_engine/formulas.cpp b/source/engines/unity_engine/formulas.cpp index cccc16c..0019c4a 100644 --- a/source/engines/unity_engine/formulas.cpp +++ b/source/engines/unity_engine/formulas.cpp @@ -27,7 +27,7 @@ namespace omath::unity_engine } Mat4x4 CalcViewMatrix(const ViewAngles& angles, const Vector3& cam_origin) { - return MatCameraView(ForwardVector(angles), RightVector(angles), + return MatCameraView(ForwardVector(angles), -RightVector(angles), UpVector(angles), cam_origin); } Mat4x4 CalcPerspectiveProjectionMatrix(const float fieldOfView, const float aspectRatio, const float near, diff --git a/tests/engines/unit_test_unity_engine.cpp b/tests/engines/unit_test_unity_engine.cpp index 48b8b46..2e0daaa 100644 --- a/tests/engines/unit_test_unity_engine.cpp +++ b/tests/engines/unit_test_unity_engine.cpp @@ -51,7 +51,8 @@ TEST(UnitTestUnityEngine, Project) constexpr auto fov = omath::projection::FieldOfView::FromDegrees(60.f); const auto cam = omath::unity_engine::Camera({0, 0, 0}, {}, {1280.f, 720.f}, fov, 0.03f, 1000.f); - const auto proj = cam.WorldToScreen({0.f, 2.f, 10.f}); + const auto proj = cam.WorldToScreen({5.f, 3, 10.f}); + std::println("{} {}", proj->x, proj->y); } TEST(UnitTestUnityEngine, CameraSetAndGetFov)