Using Bullet Physics.
There's a rigid body that is rotated. For some delta-time I need to rotate that body to have rotation of (0, y, 0) - keep the old y value rotation but reset x and z. The position of the body is described by Quaternion. And, of course, I can modify the angular velocity.
So, how to calculate what angular velocity should I set for rigidBody to rotate to necessary rotation angle in delta-time? Seen this article: http://en.wikipedia.org/wiki/Quaternions_and_spatial_rotation, but it would be exageration to say if I understand how to implement those formulas...
Here's what I have as initial state of the rigidBody:
rigidBody.getWorldTransform(tmpM1); Quaternion rotation = new Quaternion(); tmpM1.getRotation(rotation); Vector3 angles = new Vector3(); rotation.getAxisAngle(angles);