Absolute position of a hinge

Post Reply
nawal
Posts: 1
Joined: Sun Dec 13, 2015 6:30 pm

Absolute position of a hinge

Post by nawal »

Hi,

I created two bodies in space, and linked them by a btHingeConstraint. I can retrieve the position and rotation of the actual bodies to render using:

Code: Select all

box1RigidBody->getMotionState()->getWorldTransform( trans );
But I also want to render the hinge as a cylinder. How can I retrieve the absolute position and rotation of the hinge (i.e. it's orientation in space, not the angle of the hinge itself)?

Relatedly, is there a difference between getAFrame and getFrameAOffset?

Thanks
Basroil
Posts: 463
Joined: Fri Nov 30, 2012 4:50 am

Re: Absolute position of a hinge

Post by Basroil »

You can get the position in respect to one of the bodies, the absolute position of the body, and then just multiply the transforms to get both position and initial orientation. Not too difficult or time consuming. If you multiply again by the rotation, you can get that too if you need it later.
Post Reply