Here's the code I used to test euler angles to matrix to quaternion.
Code: Select all
// build a matrix from euler angles
btMatrix3x3 btMat;
btMat.setEulerYPR( yaw, pitch, roll );
// convert the matrix to a quaternion
btQuaternion btFromMat;
btMat.getRotation( btFromMat );
Code: Select all
btQuaternion btQuat;
btQuat.setEuler( yaw, pitch, roll );
Actually, as I'm writing this i look into bullet's code, and maybe I see the issue:
Code: Select all
void btMatrix3x3::setEulerYPR(const btScalar& yaw, const btScalar& pitch, const btScalar& roll)
{
setEulerZYX(roll, pitch, yaw);
}
Code: Select all
/** @brief Set the matrix from euler angles YPR around ZYX axes
* @param eulerX Roll about X axis
* @param eulerY Pitch around Y axis
* @param eulerZ Yaw aboud Z axis
*
* These angles are used to produce a rotation matrix. The euler
* angles are applied in ZYX order. I.e a vector is first rotated
* about X then Y and then Z
**/
void setEulerZYX(btScalar eulerX,btScalar eulerY,btScalar eulerZ) {