WiimoteEmu: Use quaternions for orientation.
This commit is contained in:
parent
09431635f3
commit
907fdd26fc
|
@ -734,10 +734,10 @@ Common::Matrix44 Wiimote::GetTransformation(const Common::Matrix33& extra_rotati
|
||||||
Common::Matrix44::Translate(-m_swing_state.position - m_point_state.position);
|
Common::Matrix44::Translate(-m_swing_state.position - m_point_state.position);
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Matrix33 Wiimote::GetOrientation() const
|
Common::Quaternion Wiimote::GetOrientation() const
|
||||||
{
|
{
|
||||||
return Common::Matrix33::RotateZ(float(MathUtil::TAU / -4 * IsSideways())) *
|
return Common::Quaternion::RotateZ(float(MathUtil::TAU / -4 * IsSideways())) *
|
||||||
Common::Matrix33::RotateX(float(MathUtil::TAU / 4 * IsUpright()));
|
Common::Quaternion::RotateX(float(MathUtil::TAU / 4 * IsUpright()));
|
||||||
}
|
}
|
||||||
|
|
||||||
Common::Vec3 Wiimote::GetTotalAcceleration() const
|
Common::Vec3 Wiimote::GetTotalAcceleration() const
|
||||||
|
@ -758,8 +758,9 @@ Common::Vec3 Wiimote::GetTotalAngularVelocity() const
|
||||||
|
|
||||||
Common::Matrix44 Wiimote::GetTotalTransformation() const
|
Common::Matrix44 Wiimote::GetTotalTransformation() const
|
||||||
{
|
{
|
||||||
return GetTransformation(Common::Matrix33::FromQuaternion(m_imu_cursor_state.rotation) *
|
return GetTransformation(Common::Matrix33::FromQuaternion(
|
||||||
Common::Matrix33::RotateX(m_imu_cursor_state.recentered_pitch));
|
m_imu_cursor_state.rotation *
|
||||||
|
Common::Quaternion::RotateX(m_imu_cursor_state.recentered_pitch)));
|
||||||
}
|
}
|
||||||
|
|
||||||
} // namespace WiimoteEmu
|
} // namespace WiimoteEmu
|
||||||
|
|
|
@ -162,7 +162,7 @@ private:
|
||||||
GetTransformation(const Common::Matrix33& extra_rotation = Common::Matrix33::Identity()) const;
|
GetTransformation(const Common::Matrix33& extra_rotation = Common::Matrix33::Identity()) const;
|
||||||
|
|
||||||
// Returns the world rotation from the effects of sideways/upright settings.
|
// Returns the world rotation from the effects of sideways/upright settings.
|
||||||
Common::Matrix33 GetOrientation() const;
|
Common::Quaternion GetOrientation() const;
|
||||||
|
|
||||||
Common::Vec3 GetTotalAcceleration() const;
|
Common::Vec3 GetTotalAcceleration() const;
|
||||||
Common::Vec3 GetTotalAngularVelocity() const;
|
Common::Vec3 GetTotalAngularVelocity() const;
|
||||||
|
|
Loading…
Reference in New Issue