Page 1 of 1

Torque angles

Posted: Tue Dec 01, 2009 6:39 pm
by danisegarra
Hello:
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 );
But it doesn't work to me.
Anyone can tell me where is my mistake?
Thank you!

Re: Torque angles

Posted: Thu Dec 03, 2009 11:41 am
by Flix
danisegarra wrote:

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.
You may find these posts useful:
http://bulletphysics.org/Bullet/phpBB3/ ... 74&start=0
http://www.bulletphysics.org/Bullet/php ... 40&start=0

Re: Torque angles

Posted: Thu Dec 03, 2009 2:42 pm
by danisegarra
Thank you Flix.
I'm going to check it now.