diff options
| author | iwubcode <iwubcode@users.noreply.github.com> | 2020-12-26 23:08:40 -0600 |
|---|---|---|
| committer | iwubcode <iwubcode@users.noreply.github.com> | 2021-01-27 18:22:10 -0600 |
| commit | d35287b6e49fe265729d1d8a83630cb4ff7e6367 (patch) | |
| tree | 5d2ca8956027a8adfae1a4ff94de55f6d2e01440 /Source/Core/Common/Matrix.cpp | |
| parent | 544692f96a09c1a76ff259bc1b5e91e9fef57bc4 (diff) | |
Common: update Quaternion to allow rotating pitch, yaw, and roll all at once
Diffstat (limited to 'Source/Core/Common/Matrix.cpp')
| -rw-r--r-- | Source/Core/Common/Matrix.cpp | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/Source/Core/Common/Matrix.cpp b/Source/Core/Common/Matrix.cpp index 421dda28f5..9f5ff40cb3 100644 --- a/Source/Core/Common/Matrix.cpp +++ b/Source/Core/Common/Matrix.cpp @@ -56,6 +56,13 @@ Quaternion Quaternion::RotateZ(float rad) return Rotate(rad, Vec3(0, 0, 1)); } +Quaternion Quaternion::RotateXYZ(const Vec3& rads) +{ + const auto length = rads.Length(); + return length ? Common::Quaternion::Rotate(length, rads / length) : + Common::Quaternion::Identity(); +} + Quaternion Quaternion::Rotate(float rad, const Vec3& axis) { const auto sin_angle_2 = std::sin(rad / 2); |
