some problems in rotating the rigid body

Post Reply
water
Posts: 33
Joined: Fri Jun 05, 2020 8:36 am

some problems in rotating the rigid body

Post by water »

Hello, I found some problems in rotating the rigid body.

First, I rotate the rigid body 45 degrees around the y-axis
Image,
and then I rotate it 90 degrees on the x-axis
Image.

But I found that the rigid body didn't rotate along the X axis the second time
Image

Code: Select all

		btQuaternion quaternion = btQuaternion(yaw * RADIANS_PER_DEGREE, pich * RADIANS_PER_DEGREE, roll* RADIANS_PER_DEGREE);
			trans.setRotation(quaternion);
			body->setCenterOfMassTransform(trans);

Code: Select all

	case Qt::Key_Z:
		pich += 0.2f;
		update();
		break;
	case Qt::Key_C:
		roll -= 0.25f;
		pich -= 0.2f;
		update();
		break;
What should I do? Thank you very much.
Post Reply