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); }