When I use Quaternion as orientation, I get the Column 0 for the right vector, Column 1 for the forward vector. And here is how I get them:
AZ::Vector3 GetColumn0(const AZ::Quaternion &quat)
{
return AZ::Vector3(
2.0f * (quat.GetX() * quat.GetX() + quat.GetW() * quat.GetW()) - 1.0f,
2.0f * (quat.GetY() * quat.GetX() + quat.GetZ() * quat.GetW()),
2.0f * (quat.GetZ() * quat.GetX() - quat.GetY() * quat.GetW())
);
}
AZ::Vector3 GetColumn1(const AZ::Quaternion &quat)
{
return AZ::Vector3(
2.0f * (quat.GetX() * quat.GetY() - quat.GetZ() * quat.GetW()),
2.0f * (quat.GetY() * quat.GetY() + quat.GetW() * quat.GetW()) - 1.0f,
2.0f * (quat.GetZ() * quat.GetY() - quat.GetX() * quat.GetW())
);
}
But I want to use the function of Lumberyard framework to get the column instead of write the function myself.
Does anyone know if there is a function to get Column of Quaternion in C++?