mirror of
https://github.com/bulletphysics/bullet3
synced 2024-12-15 22:20:12 +00:00
fixed 'getEuler' method
This commit is contained in:
parent
eca55afe4d
commit
f1e929f8a4
@ -207,30 +207,32 @@ class btMatrix3x3 {
|
||||
q.setValue(temp[0],temp[1],temp[2],temp[3]);
|
||||
}
|
||||
|
||||
|
||||
|
||||
void getEuler(btScalar& yaw, btScalar& pitch, btScalar& roll) const
|
||||
{
|
||||
pitch = btScalar(btAsin(-m_el[2].x()));
|
||||
if (pitch < SIMD_2_PI)
|
||||
|
||||
if (btScalar(m_el[1].z()) < btScalar(1))
|
||||
{
|
||||
if (pitch > SIMD_2_PI)
|
||||
if (btScalar(m_el[1].z()) > -btScalar(1))
|
||||
{
|
||||
yaw = btScalar(btAtan2(m_el[1].x(), m_el[0].x()));
|
||||
pitch = btScalar(btAsin(-m_el[1].y()));
|
||||
roll = btScalar(btAtan2(m_el[2].y(), m_el[2].z()));
|
||||
}
|
||||
else
|
||||
{
|
||||
yaw = btScalar(-btAtan2(-m_el[0].y(), m_el[0].z()));
|
||||
pitch = SIMD_HALF_PI;
|
||||
roll = btScalar(0.0);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
yaw = btScalar(btAtan2(-m_el[0].y(), m_el[0].z()));
|
||||
pitch = -SIMD_HALF_PI;
|
||||
roll = btScalar(0.0);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user