How to change RigidBody rotation in Bullet Physics?

Started by
4 comments, last by Medo Mex 11 years, 5 months ago
How can I change (Pitch, Yaw, Roll) of a RigidBody in Bullet Physics?

I am using DirectX and C++.
Advertisement
Kinematic rigid bodies: you update a new quaternion using its MotionState. It is also possible to fetch it directly to the object (you probably want to do the former).
Dynamic rigid bodies: in line of concept you should do that by injecting forces. I don't recommend to do that.
Static rigid bodies: just don't.

Previously "Krohm"

Any sample code to apply Pitch, Yaw, Roll to RigidBody?
Could anyone give us some part of code?
Create a rotation:

btQuaternion rotation(yaw,pitch,roll);

Then implement btMotionState, (in your class that represent the object) and in getWorldTransform do this:

worldTrans.setRotation(rotation);
I tried the above code, it's rotating weirdly when I just change rotation X value.

This topic is closed to new replies.

Advertisement