btTransform relative to corner, not center, of btBoxShape?

chikin
Posts: 1
Joined: Tue Jan 19, 2010 6:56 pm

btTransform relative to corner, not center, of btBoxShape?

Post by chikin »

Hello all,

I'm new to Bullet and I'm experimenting with making small changes to the demos to explore and learn the API. I do have a couple of questions that have arisen from the way I've been trying to accomplish a task.

I'm trying to position a btRigidBody with shape btBoxShape in my world using a btTransform, but my main issue is that I need the rotation and the translation to be about one of the corners of the btBoxShape, not the 'center' of the shape at (0, 0, 0), if that makes sense. As I understand it, if I have a btBoxShape's whose half-extents are (0.5, 0.5, 5), then one of the corners of the box is at (0.5, -0.5, -5). What I want to do is rotate the box about the Y axis through this point so that this point remains fixed, then I can translate the box to the appropriate position.

However, if I use a btTransform to set up a rotation and translation for the box, it will first rotate about the origin of the box, which is (0, 0, 0), then perform the translation. That of course moves my reference point and the box doesn't end up where I want it to go.

So, in short, what's the best way to have the transform occur using my specified corner point and not the center of the btBoxShape? Is there a general formula for computing the btTransform required to rotate an object about an axis relative to an arbitrary point on the shape?

Thanks,
Aaron