Rotation of a rigidbody

javhago
Posts: 2
Joined: Sun Mar 27, 2016 1:52 am

Rotation of a rigidbody

Post by javhago »

Hi everyone,

i'm new (noob) using bullet and i have this problem. i've been tried to rotate an object but it seems not working.

this is my code:

Code: Select all

btScalar yaw;
	btScalar pitch;
	btScalar roll;
	double const pi=3.14159;

	pitch=angle*(pi/180);

	btTransform trans;
	btQuaternion quat;
	quat.setEuler(yaw,pitch,roll);
	sphere->getMotionState()->getWorldTransform(trans);
	trans.setRotation(quat);
        sphere->setWorldTransform(trans);

thanks for your help!

PS: i've tried with this too:

Code: Select all

sphere->getCenterofMassTransform(trans);
aviator
Posts: 13
Joined: Thu Apr 02, 2015 5:15 pm

Re: Rotation of a rigidbody

Post by aviator »

javhago wrote:Hi everyone,

i'm new (noob) using bullet and i have this problem. i've been tried to rotate an object but it seems not working.

this is my code:

Code: Select all

btScalar yaw;
	btScalar pitch;
	btScalar roll;
	double const pi=3.14159;

	pitch=angle*(pi/180);

	btTransform trans;
	btQuaternion quat;
	quat.setEuler(yaw,pitch,roll);
	sphere->getMotionState()->getWorldTransform(trans);
	trans.setRotation(quat);
        sphere->setWorldTransform(trans);

thanks for your help!

PS: i've tried with this too:

Code: Select all

sphere->getCenterofMassTransform(trans);
We have gone through this issue already ... for quite a few times ... you can't set directly transformation to the rigid body, but you could create your custom class that would inherit btActionInterface and include rigid body as an object, and with a help of that set transformation for the rigid body.

http://www.bulletphysics.org/Bullet/php ... =9&t=10518
javhago
Posts: 2
Joined: Sun Mar 27, 2016 1:52 am

Re: Rotation of a rigidbody

Post by javhago »

Thanks a lot aviator.

I'm gonna try it that way. In fact, i've been searching for a few days but anyone said anything like it. :)