From 11c053e28c6e9eeafb71eb55de7081319d0193dd Mon Sep 17 00:00:00 2001 From: Orange Date: Thu, 23 Apr 2026 21:24:46 +0300 Subject: [PATCH] fixed rotation ordering --- source/engines/unreal_engine/formulas.cpp | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/source/engines/unreal_engine/formulas.cpp b/source/engines/unreal_engine/formulas.cpp index f8bd02b..9405824 100644 --- a/source/engines/unreal_engine/formulas.cpp +++ b/source/engines/unreal_engine/formulas.cpp @@ -29,9 +29,13 @@ namespace omath::unreal_engine } Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept { - return mat_rotation_axis_x(angles.roll) - * mat_rotation_axis_z(angles.yaw) - * mat_rotation_axis_y(-angles.pitch); + // UE FRotator is intrinsic Z-Y-X (Yaw → Pitch → Roll applied in local + // frame), which for column-vector composition is Rz·Ry·Rx. + // Pitch and roll axes in omath spin opposite to UE's convention, so + // both carry a sign flip. + return mat_rotation_axis_z(angles.yaw) + * mat_rotation_axis_y(-angles.pitch) + * mat_rotation_axis_x(-angles.roll); }