Fully generic example of adding a constraint
Posted: Sat Mar 09, 2013 3:53 pm
Could someone provide a good example of how to add a btGeneric6DofSpringConstraint between two rigid bodies, given those two bodies and two anchor points (in world coordinates)? The constraint demo isn't helpful for this, as it doesn't take into account the orientations of the two bodies and most of the values are just arbitrary constants. I need to be able to add a constraint while in-game not knowing anything in advance.
I've tried a number of different things, and some have sorta worked. And that's what makes this difficult for me to debug - at a certain point, I can't tell if I'm doing the linking wrong, or if I have the constraint settings wrong in some way (or established in the wrong order), or if I'm encountering a Bullet quirk. So it would really help to just have a good example. Some part of this that I can be sure is correct.
some keywords: frameInA, frameInB, useLinearReferenceFrameA
I've tried a number of different things, and some have sorta worked. And that's what makes this difficult for me to debug - at a certain point, I can't tell if I'm doing the linking wrong, or if I have the constraint settings wrong in some way (or established in the wrong order), or if I'm encountering a Bullet quirk. So it would really help to just have a good example. Some part of this that I can be sure is correct.
Code: Select all
void link(btRigidBody* A, btRigidBody* B, btVector3 anchorA, btVector3 anchorB)
{
btGeneric6DofSpringConstraint* constraint;
// now what?
}