mirror of
https://github.com/dolphin-emu/dolphin.git
synced 2025-08-04 07:09:03 +00:00
WiimoteEmu: Fix gyroscope/quaternion conversion math.
This commit is contained in:
parent
6eb1f8beba
commit
bf53e14abe
1 changed files with 3 additions and 1 deletions
|
@ -398,7 +398,9 @@ Common::Quaternion GetRotationFromAcceleration(const Common::Vec3& accel)
|
||||||
|
|
||||||
Common::Quaternion GetRotationFromGyroscope(const Common::Vec3& gyro)
|
Common::Quaternion GetRotationFromGyroscope(const Common::Vec3& gyro)
|
||||||
{
|
{
|
||||||
return Common::Quaternion{1, gyro.x / 2, gyro.y / 2, gyro.z / 2};
|
const auto length = gyro.Length();
|
||||||
|
return (length != 0) ? Common::Quaternion::Rotate(length, gyro / length) :
|
||||||
|
Common::Quaternion::Identity();
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Matrix33 GetRotationalMatrix(const Common::Vec3& angle)
|
Common::Matrix33 GetRotationalMatrix(const Common::Vec3& angle)
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue