I tried this:
Code: Select all
btVector3 delta = hitTransform.getOrigin()
- spawned->rigidBody->getWorldTransform().getOrigin();
delta *= 0.5;
btTransform temp1;
temp1.setIdentity();
btTransform temp2;
temp2.setIdentity();
temp1.setOrigin(delta);
temp2.setOrigin(-delta);
btTypedConstraint* p2p = new btFixedConstraint(*spawned->rigidBody,
*hitRigidBody, temp1, temp2);
I tried adding
Code: Select all
temp1.setRotation(hitTransform.getRotation());
temp2.setRotation(hitTransform.getRotation());
Basically, I am failing to understand what should the transforms taken by btFixedConstraint represent.
How do I calculate those transforms so the constraint will keep both where they are right now relative to each other?