Basically I've got a GUI where the user can input euler angle rotations in degrees for X, Y and Z (so Pitch, Yaw, Roll).
Then I'm creating a quaternion based of these values with the directx function:
XMQuaternionRotationRollPitchYaw(DegToRad(newRotation.x), DegToRad(newRotation.y), DegToRad(newRotation.z));
DegToRad is my own wrapper function that does:
inline float DegToRad(const float& deg)
{
return float(deg * (PI / 180.0f));
}
Now the problem I'm having is when inputting 180 degrees as yaw my resulting quaternion looks like this:
{3,49459e-007, 0, 1, 0} (w, z, y, x order)
In my application it still works but then I'm writing that out to a text file as a floating point value and after reading it again my rotation gets completely messed up. Which I assume is because of this w-component. Any ideas what's wrong? Is it just a floating point precision problem ?