I'm developing an iPhone application using SIO2 engine that uses Bullet engine.
I use applyTorque function to rotate an object, and sometimes I want to know the values of the rotation params (X, Y, Z) to apply the object rotation to a new object.
First, I was using getEulerYPR function, and it works only in the cases that I doesn't rotate so much my object.
After that I was looking for a function to get the angles (X, Y, Z) from a quaternion, but I can't find any function.
Finaly I was trying to get the quaternion of the original object and aply it to the new object like this:
Code: Select all
btTransform _btTransform1;
_btTransform1.setIdentity();
_btTransform1.setFromOpenGLMatrix( Object1Matrix );
btQuaternion qObject1 = _btTransform1.getRotation();
btTransform _btTransform2;
_btTransform2.setIdentity();
_btTransform2.setRotation( qObject1 );
_btTransform2.getOpenGLMatrix( Object2Matrix );
Anyone can tell me where is my mistake?
Thank you!