How to get the Euler angles of a body from its MotionState?
Posted: Thu May 05, 2016 7:33 am
The official hello world https://github.com/bulletphysics/bullet ... d.cpp#L134 prints the x, y and z positions of a falling object, which are extracted via `body->getMotionState()->getWorldTransform(trans)`.
But how would I get the three Euler angles that represent the rotation?
I am able to get the quaternion that represents the rotation with `btTransform::getRotation()` http://bulletphysics.org/Bullet/BulletF ... 98507b7520 , but is there a convenient way to convert them to Euler angles?
I could re-implement the conversion formula as mentioned at Rotating Objects Using Quaternions http://www.gamasutra.com/view/feature/1 ... rnions.php , but I'd expect Bullet to have a built-in method for it.
I have seen http://stackoverflow.com/questions/2986 ... rigid-body but it does not use MotionState, which I've read is the preferred method (but I don't understand why yet).
Xpost at: http://stackoverflow.com/questions/3698 ... et-physics
But how would I get the three Euler angles that represent the rotation?
I am able to get the quaternion that represents the rotation with `btTransform::getRotation()` http://bulletphysics.org/Bullet/BulletF ... 98507b7520 , but is there a convenient way to convert them to Euler angles?
I could re-implement the conversion formula as mentioned at Rotating Objects Using Quaternions http://www.gamasutra.com/view/feature/1 ... rnions.php , but I'd expect Bullet to have a built-in method for it.
I have seen http://stackoverflow.com/questions/2986 ... rigid-body but it does not use MotionState, which I've read is the preferred method (but I don't understand why yet).
Xpost at: http://stackoverflow.com/questions/3698 ... et-physics