6Dof:
Hinge:
Code: Select all
btTransform BulletChildFrame;
BulletChildFrame.setIdentity();
BulletChildFrame.setOrigin(BulletChildLocalPoint);
btTransform BulletParentFrame;
BulletParentFrame.setIdentity();
BulletParentFrame.setOrigin(BulletParentLocalPoint);
btGeneric6DofConstraint* Constraint =
new btGeneric6DofConstraint(*Parent->PhysicBody, *Child->PhysicBody, BulletParentFrame, BulletChildFrame, true);
Constraint->setLinearLowerLimit(btVector3(0, 0, 0));
Constraint->setLinearUpperLimit(btVector3(0, 0, 0));
Constraint->setAngularLowerLimit(btVector3(0, -M_PI * 0.5, 0));
Constraint->setAngularUpperLimit(btVector3(0, M_PI * 0.5, 0));
Parent->PhysicBody->setActivationState(DISABLE_DEACTIVATION);
Child->PhysicBody->setActivationState(DISABLE_DEACTIVATION);
World->addConstraint(Constraint, true);