Math problem / oculus "extreme" rotation
Hello !
I am having a "simple" math problem on oculus integration on CryEngine (orignal code is not written by myself), and I am looking for a clean solution, that I have trouble to find by myself.
I am trying to fix a bug, that invert Pitch once the player has turn about 180 degree - In that case, looking up makes the player look down.
I am using the following code.
The idea is to get the the delta orientation each frame, and combine that delta in the "final" listener function, combining mouse infos and OVR data.
and, later, in the player input function :
That seems ok to me, but once turned back of 180 degree, the Pitch is reverted.
Anyone knows how to fix this ?
I am having a "simple" math problem on oculus integration on CryEngine (orignal code is not written by myself), and I am looking for a clean solution, that I have trouble to find by myself.
I am trying to fix a bug, that invert Pitch once the player has turn about 180 degree - In that case, looking up makes the player look down.
I am using the following code.
The idea is to get the the delta orientation each frame, and combine that delta in the "final" listener function, combining mouse infos and OVR data.
Quat sCurrentOrientation(m_pDevice->GetOrientation());
m_PreviousOrientation.Invert();
Quat sDeltaOrientation(sCurrentOrientation*m_PreviousOrientation);
m_PreviousOrientation=sCurrentOrientation;
Ang3 sDelta(sDeltaOrientation);
{
//send x, y, z to input listener
}
//with :
virtual Quat GetOrientation() const { OVR::Quatf q = m_senFusion.GetOrientation(); return Quat(q.w, q.x, q.y, q.z); }
and, later, in the player input function :
Ang3 deltaRotation = m_deltaRotation * mouseSensitivity * generalSensitivity; //"mouse movement"
deltaRotation += m_HMD_deltaRotation; // combine mouse movement and Oculus data
That seems ok to me, but once turned back of 180 degree, the Pitch is reverted.
Anyone knows how to fix this ?
