mirror of
https://github.com/orange-cpp/omath.git
synced 2026-04-25 16:03:30 +00:00
fixed rotation ordering
This commit is contained in:
@@ -29,9 +29,13 @@ namespace omath::unreal_engine
|
|||||||
}
|
}
|
||||||
Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
Mat4X4 rotation_matrix(const ViewAngles& angles) noexcept
|
||||||
{
|
{
|
||||||
return mat_rotation_axis_x<float, MatStoreType::ROW_MAJOR>(angles.roll)
|
// UE FRotator is intrinsic Z-Y-X (Yaw → Pitch → Roll applied in local
|
||||||
* mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.yaw)
|
// frame), which for column-vector composition is Rz·Ry·Rx.
|
||||||
* mat_rotation_axis_y<float, MatStoreType::ROW_MAJOR>(-angles.pitch);
|
// Pitch and roll axes in omath spin opposite to UE's convention, so
|
||||||
|
// both carry a sign flip.
|
||||||
|
return mat_rotation_axis_z<float, MatStoreType::ROW_MAJOR>(angles.yaw)
|
||||||
|
* mat_rotation_axis_y<float, MatStoreType::ROW_MAJOR>(-angles.pitch)
|
||||||
|
* mat_rotation_axis_x<float, MatStoreType::ROW_MAJOR>(-angles.roll);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user