Torque angles

Post Reply
danisegarra
Posts: 4
Joined: Mon Nov 02, 2009 4:23 pm

Torque angles

Post 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!
Flix
Posts: 456
Joined: Tue Dec 25, 2007 1:06 pm

Re: Torque angles

Post 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
danisegarra
Posts: 4
Joined: Mon Nov 02, 2009 4:23 pm

Re: Torque angles

Post by danisegarra »

Thank you Flix.
I'm going to check it now.
Post Reply