You can use a btTransform to apply all transformations to the rigid body. Keep in mind, that if you do not make the rigid body static, it may react weird if the bullet world is also trying to manipulate it.

There are some helper functions in ofxBullet. https://github.com/NickHardeman/ofxBulletYou should check out ofxBulletUtils.h and some of the create functions for shapes that take an ofQuaternion as an argument.

I haven't tested the code, but this should be a good start.

// transform of the rigid body, which we will get from the object and then manipulate //
btTransform tr;
// position of the object in world coords //
ofVec3f myPos;
ofQuaternion myQuat; // this is what you can manipulate with arrow keys // etc.
rigidBody->getMotionState()->getWorldTransform( tr );
// set the position //
tr.setOrigin( btVector3( btScalar(myPos.x), btScalar(myPos.y), btScalar(myPos.z)) );
// zero out rotation, if you want //
tr.getBasis().setEulerZYX( 0,0,0 );
// apply your quat rotation to the transform //
tr.setRotation( btQuaternion(btVector3(myQuat.x(), myQuat.y(), myQuat.z()), myQuat.w()) );
// apply your new transform to the rigid body //
rigidBody->getMotionState()->setWorldTransform( tr );

If you want to get the orientation and position of the rigid body, check out the following

Hi Nick sort of work to be more specific I am trying to apply the rotation to the ground body in the Simple example from the ofxBullet addon, I try your code and I manage to rotate the grey box but the debug green outlines doesn't rotate, I guess that green outline box is the collision shape I try to apply the rotations to that shape but unsuccessful any ideas?

Ahh yes. The problem is that the object you are manipulating needs to be declared as kinematic. It must have a mass of 0.f!! Then you must apply your transformations and activate the rigid body. I have updated ofxBullet to include this in the shapes. You need to pull the latest from git to have the convenience functionshttps://github.com/NickHardeman/ofxBullet

Code example spinning the ground from the Simple Example below:

In your setup function:

// set quaternion, so we know which way is up //
ofQuaternion groundQuat;
groundQuat.set(0, 1, 0, 1.);
ground.create( world.world, ofVec3f(0., 5.5, 0.), groundQuat, 0., 10.f, 1.f, 10.f );
ground.setProperties(.25, .95);
ground.add();
// allows manipulation of object. The object will not react to other objects, but will apply forces to them //
// just like a static object, except you can move it around //
ground.enableKinematic();

Now in the update function:

// store the position of the ground //
ofVec3f pos = ground.getPosition();
// create a bullet transform object and set the position to that of the object //
btTransform trans;
trans.setOrigin( btVector3( btScalar(pos.x), btScalar(pos.y), btScalar(pos.z)) );
// get the rotation quaternion from the ground //
ofQuaternion rotQuat = ground.getRotationQuat();
// print out the angle
cout << "rotation " << rotQuat.w() << endl;
float newRot = rotQuat.w();
// rotate it a bit //
newRot += .01f;
// clamp values between PI and -PI so there is no jumping //
if(newRot >= PI) newRot -= PI;
if(newRot <= 0) newRot += PI;
// set the rotation of the bullet transform to that of the axis of the stored quaternion
// and apply the new rotation
trans.setRotation( btQuaternion(btVector3(rotQuat.x(), rotQuat.y(), rotQuat.z()), newRot) );
// apply the transform to the rigid body //
ground.getRigidBody()->getMotionState()->setWorldTransform( trans );
// tell the ofxBulletWorldRigid that we have moved rigid body and it should update the collision object //
ground.activate();

I have tested out this code and it appears to work. Let me know if you have any issues.